ComponentState<T extends StatefulComponent> class
abstract
Components
Core
State Management
Base class for managing the state of a StatefulComponent.
A ComponentState
represents the mutable data and behavior
associated with a StatefulComponent instance. The framework
will create a ComponentState object when a StatefulComponent
is inserted into the component tree, and may call its lifecycle
methods during rendering.
Responsibilities:
- Hold and mutate state that affects how the component is built.
- Build and return a tree of child Components via build.
- Notify the framework to rebuild when state changes via setState.
Lifecycle:
Constructors
Properties
- component ↔ T
-
The associated StatefulComponent that owns this state.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- instance ↔ StatefulComponentInstance
-
The concrete instance for this StatefulComponent in the tree.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
) → List< Component> - Describes the component subtree for this state. Called every time the component needs to rebuild.
-
initState(
) → void - Called exactly once when the state is initialized. Override to set up state, subscribe to data sources, etc.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setState(
VoidCallback fn) → void - Marks this state as dirty and schedules a rebuild.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited