-
-
Notifications
You must be signed in to change notification settings - Fork 153
[Question] How to use registerLazySingletonAsync with SharedPreferences #273
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
When a non async Singleton depends on one with an async initialization |
@ykaito21 , you can create an AbstractCache and SharedPreferenceImpl
After that use AbstractClass in NumberTriviaLocalDataSourceImpl. So and fix your di/service_locator.dart like:
|
Step 1: Register your dependency(shared preferences)
Step 2: Attach the function to main func Step 3: Usage |
Uh oh!
There was an error while loading. Please reload this page.
I'm doing ResoCoder's TDD Clean Architecture Course, and it use get_it as DI.
It was created in 2019, I tried to create the updated version, but I couldn't find the clear way to handle the case. Am I doing something wrong? Should I use
registerSingletonWithDependencies
or Is there any better way?This is the original code:
get_it: ^3.1.0
This is my updated version:
get_it: ^7.2.0
The text was updated successfully, but these errors were encountered: