I have an InheritedWidget
at the root of my application, basically at the top of the first build function of my first Scaffold
. I can reference the widget using the .of(context)
function just fine from all sub-widgets of the first page. if I push another page on the Navigator
stack, the InheritedWidget.of()
call fails, as I assume it should. Is there a way to share access to this widget? I'm trying to avoid passing widgets down the tree unnecessarily. ScopedModel has the same limitation. I was thinking about passing the context variable down the tree, but that doesn't sound right and it doesn't solve the issue either.
You should wrap your root widget with it, for example your MaterialApp
MyInheritedWidget(
child: MaterialApp(
home: home))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With