Replies: 1 comment
-
Why can not dioProvider be a Then, you only have to await for that future in the providers that use it. |
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
-
In my app I'm using Dio for http request. I have a
dioProvider
like this:Later, I try to add a plugin to Dio to manage the cookies but a can't use
async
from a "normal"Provider
:I see this approach of
SharedPreferences
throwing anUnimplementedError
, waiting for theSharedPreferences
instance in the main method and later overwriting theProvider
value inside theProviderScope
:But it may be the case that the value that we have to wait to initialize a provider takes some time and we don't want to block the start of the application.
My question is:
How to overwrite providers with asynchronous values until we need them but not awaiting for the values in the main method?
For example. Returning to the example of the
dioProvider
. I have aloginRepositoryProvider
that depends on it, and aloginNotifierProvider
(StateNotifierProvider
) that depends on the repository...What would be the exact way and time to initialize the
dioProvider
so that everything works correctly?I hope you can help me. Thanks for taking the time to read my question.
Beta Was this translation helpful? Give feedback.
All reactions