StateSignal<T> class

A tiny reactive value for Flint UI components.

Use StateSignal when a value can change after the first render, for example data from a WebSocket, a timer, or a client-side form.

final count = StateSignal<int>(0);

count.value = count.value + 1;

To rebuild UI automatically, wrap the changing part of the page with StateSignalListener.

Constructors

StateSignal(T _value)
Creates a signal with an initial value.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value ↔ T
The current value.
getter/setter pair

Methods

dispose() → void
Removes every listener.
listen(StateSignalCallback<T> listener, {bool fireImmediately = false}) StateSignalSubscription
Runs listener whenever the signal changes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify() → void
Short alias for notifyListeners.
notifyListeners() → void
Notifies listeners without replacing the value.
set(T next) → void
Replaces the current value and notifies every listener.
toString() String
A string representation of this object.
inherited
update(T updater(T value)) → T
Replaces the value by calculating a new value from the current value.

Operators

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