ValueState<T> class

A reactive state holder that can be externally updated and refreshed.

Ideal for state that does not need an initial value at creation time. The state is null-safe but must be initialized via refreshWith or refreshUpdate.

Constructors

ValueState.new()
Creates a new ValueState with an auto-generated key.

Properties

data → T
Returns the current value of this state.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
uniqueKey UniqueKey
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on(Widget build(T)) StateBuilder
Associates this state with a reactive widget built using the given function.
refreshUpdate(T update(T?)) → void
Updates the current state using a functional transformer update, which receives the previous state and returns the new one.
refreshWith(T newState) → void
Replaces the current state with newState and triggers a widget rebuild.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited