ComputedObservable<T> class
A derived observable value that automatically updates when its dependencies change.
The (ComputedObservable) listens to a list of (Observable) and recomputes its value whenever any of them changes. It is read-only and cannot be directly mutated.
- Inheritance
-
- Object
- Observable<
T> - ComputedObservable
Constructors
-
ComputedObservable.new(ComputeFunction<
T> _compute, List<Observable> _dependencies) - Creates a new ComputedObservable with the provided compute function and dependencies.
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
-
Gets the current value and tracks the observer if present.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Adds a specific listener to this observable.
inherited
-
dispose(
) → void -
Disposes the computed observable by removing all dependency listeners.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
) → T -
Returns the current value without tracking dependency.
inherited
-
removeListener(
VoidCallback listener) → void -
Removes a specific listener from this observable.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
watch(
) → T -
Returns the current value and tracks the dependency for reactivity.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited