Is this the generally accepted way to handle state on disposed AsyncNotifiers? #2960
Unanswered
joakimunge
asked this question in
Q&A
Replies: 3 comments 3 replies
-
Little bump <3 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Providers should stop all operations when they are disposed. You shouldn't keep running logic after dispose |
Beta Was this translation helpful? Give feedback.
2 replies
-
Hi @joakimunge @Colman |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We've noticed some errors bubbling up to our general error handlers from our
AsyncNotifiers
:Bad state: Future already completed
It seems to be because we're setting the state of already disposed providers. In this case, pressing a button which performs async ops, and then moving to another screen (disposing the button action controller). Here is a simplified code example of the method on the notifier:
Is the solution in #1879 suggested way to handle these cases? It seems like a lot of boilerplate to add to every autoDisposable notifier.
Is there a reason why this isn't done in the framework? I would think
AsyncValue
guard would catch this error, but it does not .Beta Was this translation helpful? Give feedback.
All reactions