Summary
We studied three major areas of basic state management in this chapter – the setState
method, inherited widgets, and inherited models,
The setState
method is the most basic form of state management, where, using a function provided by the Flutter framework, you can tell your code which values to update and rebuild your widgets accordingly. This technique rebuilds the whole main widget you are standing inside, along with all the widgets that are called inside your main widget. We also learned how to pass down your state using constructors, and pass back the values using the pop
function and callbacks.
Inherited widgets come to the rescue by passing down the state deep within the widget hierarchy using constructors. The main inherited widget sits at the top of your widget hierarchy and passes the state down using the .of
method. It uses context to make the state accessible to all the widgets down the widget tree.
Inherited models are an optimized version of inherited...