Observer class
Tracks reactive dependencies and triggers a callback when they change.
An Observer monitors all Signals accessed during its tracking period. When any of these signals update, the observer's onUpdate callback is invoked.
This class is used internally by Computed and effect to manage dependency tracking and automatic reactivity.
Constructors
- Observer(VoidCallback onUpdate)
-
Creates an Observer with the given
onUpdatecallback.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- onUpdate → VoidCallback
-
Callback invoked whenever a tracked signal updates.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → void - Disposes the observer by unsubscribing from all tracked signals.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
track(
Signal s) → void - Tracks the given Signal and subscribes to updates.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited