I want to use InheritedWidget
to access and change its data from anywhere in application.
I've read many articles about InheritedWidget
, but I do not understand one of its behaviors.
Here it says that only widgets that are using InheritedWidget
get rebuilt when data changes(which is exactly what I want).
But here it says that InheritedWidget
is immutable and its data only changes when it is rebuilt itself!
So doesn't this make the whole widget tree below the InheritedWidget
get rebuilt when the data changes?
How can I wrap the MaterialApp
widget with InheritedWidget
so I can change its data from anywhere in app and only rebuild a small Widget that is using InheritedWidget
when the data changes?
I know I can implement this using provider package very easily, but in this part of application I want to use InheritedWidget
if it's possible :)