Stateful Widgets
Learn about stateful widgets in this lesson.
We'll cover the following
Rebuilding widgets in Flutter
Having a stateful widget will keep track of the build()
method.
We can manage the internal state of the widget through the class property. The following image will show us how we can see the counter value on the screen. Pressing the button will keep increasing the number. As the internal data or property’s value changes, it re-runs the build()
method, and that in turn will re-render the UI.
As a result, we see that the counter value increases with the pressing of the button.
The following code executable will show us the same effect.
Get hands-on with 1400+ tech skills courses.