Closed feyokorenhof closed 1 year ago
I don't understand your "This does not crash" code. There's no home
parameter on MultiProvider
Ah, my bad I messed that up. Edited the code.
It's about the MaterialApp builder and home function.
I'm not aware of a specific reason why that would happen. Could you make a complete reproducible example? Something executable that's also short
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.
Thanks for the quick responses!
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.
But we can close this issue afaic :).
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!!