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
Available extensions

Constructors

ComputedObservable.new(ComputeFunction<T> _compute, List<Observable> _dependencies, {EqualityFunction<T>? equals, ErrorCallback? onError})
Creates a new ComputedObservable with the provided compute function and dependencies.

Properties

computeFunction ComputeFunction<T>
Gets the compute function (read-only).
no setter
dependencies List<Observable>
Gets the list of dependencies (read-only).
no setter
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether this object has been disposed.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value ↔ T
Override the setter to prevent direct mutation of computed values.
getter/setter pairinherited-getteroverride-setter

Methods

addDisposeCallback(VoidCallback callback) → void
Add a callback to be executed during disposal.
inherited
addListener(VoidCallback listener) → void
addListener method.
inherited
addSubscription(StreamSubscription subscription) → void
Add a stream subscription to be cancelled during disposal.
inherited
combineWith<U, R>(Observable<U> other, R combiner(T, U), {EqualityFunction<R>? equals, ErrorCallback? onError}) ComputedObservable<R>
Creates a new ComputedObservable that depends on this one and additional observables.
combineWith<U, R>(Observable<U> other, R combiner(T, U)) Observable<R>

Available on Observable<T>, provided by the ObservableSelector extension

dispose() → void
Disposes the computed observable by removing all dependency listeners.
override
forceUpdate() → void
Forces a recomputation of the value, even if dependencies haven't changed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read() → T
read method.
inherited
removeListener(VoidCallback listener) → void
removeListener method.
inherited
select<R>(R selector(T), {EqualityFunction<R>? equals, ErrorCallback? onError}) ComputedObservable<R>
Creates a selector from this computed observable.
select<R>(R selector(T)) Observable<R>

Available on Observable<T>, provided by the ObservableSelector extension

selectR> method.
setDebounceTimer(Timer timer) → void
Set or update the debounce timer.
inherited
setValueDebounced(T newValue, Duration delay) → void
Override setValueDebounced to prevent direct mutation.
override
throwIfDisposed([String? operation]) → void
Throw if this object has been disposed.
inherited
toString() String
A string representation of this object.
inherited
validateEmail() Observable<String?>

Available on Observable<String>, provided by the StringValidation extension

validateEmail method.
validateLength({int? min, int? max}) Observable<String?>

Available on Observable<String>, provided by the StringValidation extension

validateLength method.
watch() → T
inherited

Operators

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