Accessing Repos by Model Type or By String #137
Unanswered
abbas-alshafai
asked this question in
Q&A
Replies: 1 comment
-
Yes it's possible. You can use the generated final repo = ref.watch(repositoryProviders['users']) as Repository<User>; Let me know if that works |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
Let's say I have a model called
User
. The docs say that I can access its repo by the generatedref.users
or byref.watch(usersRepositoryProvider)
. Is there a way to access repos by specifying model types or by passing a string (for the table/collection/box). For example, ObjectBox db does something like:final userBox = store.box<User>()
Or maybe something similar to Hive db, where a string is passed to specify the box:
final box = await Hive.openBox('users')
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions