Replies: 1 comment
-
|
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
-
I have many Riverpod providers that need async HTTP requests. Providers make local changes and apply them to the state, then do remote request and apply result to the state. I want to put these requests in order and if one request fails, the next request should not execute before the failed request succeeds. In other words, I need an async queue of methods with requests and changing providers' states. So I created an AsyncNotifierProvider FutureExecutor with Queue<Future Function(AsyncNotifierProviderRef ref)> that will execute methods. I use the ref of the provider that adds the first element in the queue. But I am wondering about circular dependency. Because of implicit dependencies, I tested this solution and have not had any errors yet, but I suppose there will be a case when the provider that adds the first element and executes other methods in the queue will call the notifier of the other provider that is dependent on the first one.
Beta Was this translation helpful? Give feedback.
All reactions