State

State

State class

A widget’s state is stored in a State object, separating the widget’s state from its appearance. The state consists of values that can change, like a slider’s current value or whether a checkbox is checked. When the widget’s state changes, the state object calls setState(), telling the framework to redraw the widget.

Objects, on the other hand, are persistent between calls to build(), allowing them to remember information.

Syntax

State<T extends StatefulWidget> class

State on api.flutter.dev

State — Structure map

Clickable & Draggable!

State — Related pages: