A state is information that (1) can be read synchronously when building a widget and (2) can change during the life of the widget. Responsibility for the implementation of the widget is responsible for ensuring that the state is immediately notified when this state changes using State.setState.
A state widget is a widget that describes part of the user interface, creating a constellation of other widgets that describe the user interface in more detail. The building process continues recursively until the user interface description is completely concrete (for example, it consists entirely of RenderObjectWidgets that describe specific RenderObjects).
A virtualized widget is useful when the part of the user interface that you describe can change dynamically, for example, due to the presence of an internal state controlled by a clock, or depending on the state of any system. For compositions that depend only on configuration information in the object itself and BuildContext, in which the widget is overpriced, consider using StatelessWidget.
StatefulWidget instances are immutable and retain their mutable state either in separate State objects that are created by the createState method, or in objects to which this state subscribes, for example, Stream or ChangeNotifier objects to which links are stored in the final StatefulWidget fields themselves.
A stateless widget is a widget that describes part of the user interface, creating a constellation of other widgets that describe the user interface in more detail. The building process continues recursively until the user interface description is completely concrete (for example, it consists entirely of RenderObjectWidgets that describe specific RenderObjects).
Widgets without saving are useful when the part of the user interface that you describe does not depend on anything other than the configuration information of the object itself and the BuildContext object in which the widget is overpriced. For compositions that can dynamically change, for example, due to the presence of an internal state controlled by a clock, or depending on the state of any system, consider using StatefulWidget.
source share