Signal<T> class
A reactive value that notifies observers when it changes.
A Signal wraps a value of type T and allows reactive components
such as Computed or effect to track and respond to its changes.
Example:
final count = Signal<int>(0);
effect(() {
print('Count changed: ${count.value}');
});
count.value = 1; // Triggers the effect and prints "Count changed: 1"
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 of the signal.
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
subscribe(
Listener l) → void - Subscribes a Listener to be called whenever the value changes.
-
toString(
) → String -
A string representation of this object.
inherited
-
unsubscribe(
Listener l) → void - Unsubscribes a previously subscribed Listener.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited