-
-
Notifications
You must be signed in to change notification settings - Fork 899
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
ProviderScope override "forgets" the StreamProvider value during navigation #10
Comments
Oh, I know It's the good-old "a provider is scoped to its route" By using ProviderScope inside a route, the override is not accessible to other routes. |
In your case, this happens not because of navigation, but because of Overlay During the transition, your Consumer is rendered above PageOne for a moment. |
Ohh I see but then what would be a good solution for that? As that value is used by both and I can not put it above the MaterialApp as let's say I have no access to the value there. (Getting the user after sign in). It feels weird to wrap both the ClosedBuilder return value and the OpenBuilder return value with a override |
Honestly, this is more of an issue with Overlay than riverpod. flutter/flutter#36220 should be fixed. As for how to fix it... Maybe consume the value above the |
Yeah did that and it works, thanks for the help! |
Hi, I'm trying to implement this solution, however I'm getting this error:
The
|
Describe the bug
When creating a StreamProvider with a value of
Stream.value(null)
and then override it in another page then this should only be null until it is set. Right now it seems like it resets when navigating with an animation.Have added a deugPrint(user.name) to easily see the behavior in the console.
To Reproduce
Click the ListTile and look at the log.
Do not forget to add dependencies in .yaml
Expected behavior
When running this the debugPrint(user.name) should not be empty during navigation.
The text was updated successfully, but these errors were encountered: