-
-
Notifications
You must be signed in to change notification settings - Fork 153
How to use with floor library? #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
you don't have to register the person in GetIt but the database. Instead of static Future<void> _registerDatabase() async {
AppDatabase database =
await $FloorAppDatabase.databaseBuilder('test.db').build();
sl.registerLazySingletonAsync(() async => database.person);
} do something like: static Future<void> _registerDatabase() async {
sl.registerLazySingletonAsync<AppDatabase>($FloorAppDatabase.databaseBuilder('test.db').build());
}
```
Then before you access it wait with
```
sl.allReady()
```
after that you can access person over
```
sl<AppDataBase>().person;
``` |
I close issue. And remove it to #101 |
using 7.2.0, and floor 1.3.0, database never get ready.
at this point, line 1 never execute no matter what. I've waited so long... Any ideas of whats going on?
|
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
Use in main.dart
===> OK
In get_id. I use like below
in main.dart
I use like below
And get error
Please help me. thank you very much.
The text was updated successfully, but these errors were encountered: