You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have to use MaterialApp'sbuilder function instead of home to ensure MediaQuery applies to nested routes. But for some reason this breaks provider and gives me a lot of ProviderNotFoundException. I am unsure if this is a bug in Provider, Flutter or a mistake I'm doing but I've tried a lot of variations with placing my MultiProvider above and below MaterialApp and placing widgets in-between them but nothing seems to work.
EDIT:
it looks like the errors only show up when I use Navigator.push() I really don't understand why this would be the case when using builder instead of home.
To Reproduce
use MaterialApp's builder function instead of home parameter.
I'm going down quite the rabbit hole atm :p. It looks like It might actually be a problem of using the context used by pushing a new MaterialPageRoute with Navigator.of(context).push(). I'll do some more testing and come back to you.
We managed to fix our problem without using builder so this is no longer an issue for us. I'm still curious as to how this behavior happened to us so I might come back to it later just for fun.
Describe the bug
I have to use
MaterialApp's
builder
function instead ofhome
to ensure MediaQuery applies to nested routes. But for some reason this breaks provider and gives me a lot ofProviderNotFoundException
. I am unsure if this is a bug in Provider, Flutter or a mistake I'm doing but I've tried a lot of variations with placing myMultiProvider
above and belowMaterialApp
and placing widgets in-between them but nothing seems to work.EDIT:
it looks like the errors only show up when I use
Navigator.push()
I really don't understand why this would be the case when using builder instead of home.To Reproduce
use MaterialApp's builder function instead of home parameter.
This does not crash:
This does:
Expected behavior
For provider to still work when using the builder function.
I'm sorry if this is a silly mistake or not a provider bug but I'm out of ideas. Any help is appreciated!!
The text was updated successfully, but these errors were encountered: