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
Assert throws: '_builtFuture == null': Bad state #1920
Comments
Could you create a sample that can be executed?
|
It's a bit difficult for me to pin down the problem for a minimum example. We're using |
Thanks! Otherwise it's a bit hard for me to pin down how it happened too. |
Always happy to break new ground 😅 I feel like I've stumbled upon a mistake on our side that might have something to do with the issue. What's the intended way of writing FutureProvider's that depend on the results of multiple other FutureProviders then? final cProvider = FutureProvider((ref) async {
final a = await ref.watch(aProvider.future);
final b = await ref.watch(bProvider.future);
// or even:
final d = await ref.watch(dProvider(a).future);
}); To my understanding, this isn't recommended because the Provider could be rebuilt due to changes to a, while b or d are still awaiting? Thank you so much for your help |
It's mainly about autoDispose. It could be a problem But I doubt that's related to your issue. |
I can't seem to find the issue and we're in a tight spot right now, so I'll have to revert to 2.0.0-dev.9 for now, everything works fine there. I'll get back to you when we have more time again but thank you for your help |
Facing the same error (version 2.1.1). |
@rrousselGit found workaround for this one: wrapping one of |
I have created a sample that can be executed: https://github.com/mgwrd/riverpod-error If you try to watch the combined provider in main.dart the error occurs. If you change line 22 to the "non-combined" provider, the error does not occur. |
Thank y'all. I'll admit I'm doing other things at the moment. If someone feels fancy fixing it that'd be sweet. Otherwise it'll probably be delayed by a few weeks |
I tinkered a bit with the code and it looks like using The relevant code:
However, I'm not sure if this is what caused the error for @timcreatedit. I still get the error in my app without using |
This should be indirectly fixed by the next release. Since there's no more |
Describe the bug
FutureProvider throws AssertionError on hooks_riverpod 2.1.1:
_AssertionError ('package:riverpod/src/async_notifier/base.dart': Failed assertion: line 219 pos 12: '_builtFuture == null': Bad state)
Stacktrace:
To Reproduce
The problem happens, when one of our FutureProvider.autoDispose tries to watch another FutureProvider.autoDispose. When exactly, I can't really tell, it seems to be timing related, but I don't understand enough about the error yet.
For reference, these are the providers in question:
The text was updated successfully, but these errors were encountered: