Until<T> class abstract interface

A cancellable future that completes when a reactive value satisfies a condition.

Until implements Future so it can be awaited directly. It also provides cancel to stop waiting and dispose the underlying effect.

The condition is checked reactively: when source changes, the predicate is re-evaluated. When it returns true, the future completes with the current value.

Important: After calling cancel, the future remains pending forever. Do not await a cancelled Until—it will never complete.

Example:

final until = Until(signal, (value) => value >= 5);
final result = await until; // Completes when condition is met

// If you need to stop waiting:
until.cancel(); // Disposes effect; do not await after this
Implemented types
Available extensions

Constructors

Until(ReadableNode<T> source, bool predicate(T value), {bool? detach})
Creates an Until that waits for source to satisfy predicate.
factory
Until.changed(ReadableNode<T> source, {bool? detach})
Creates an Until that waits for source to change from its current value.
factory
Until.when(ReadableNode<T> source, T value, {bool? detach})
Creates an Until that waits for source to equal value.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isCancelled bool
Whether cancel was called on this Until.
no setter
isCompleted bool
Whether this Until has completed (with a value or error).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toJS JSPromise<T>

Available on Future<T>, provided by the FutureOfJSAnyToJSPromise extension

A JSPromise that either resolves with the result of the completed Future or rejects with an object that contains its error.
no setter
toJS JSPromise<JSAny?>

Available on Future<void>, provided by the FutureOfVoidToJSPromise extension

A JSPromise that either resolves once this Future completes or rejects with an object that contains its error.
no setter

Methods

asStream() Stream<T>
Creates a Stream containing the result of this future.
inherited
cancel() → void
Cancels the wait and disposes the underlying effect.
catchError(Function onError, {bool test(Object error)?}) Future<T>
Handles errors emitted by this Future.
inherited
ignore() → void

Available on Future<T>, provided by the FutureExtensions extension

Completely ignores this future and its result.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError<E extends Object>(FutureOr<T> handleError(E error, StackTrace stackTrace), {bool test(E error)?}) Future<T>

Available on Future<T>, provided by the FutureExtensions extension

Handles errors on this future.
then<R>(FutureOr<R> onValue(T value), {Function? onError}) Future<R>
Register callbacks to be called when this future completes.
inherited
timeout(Duration timeLimit, {FutureOr<T> onTimeout()?}) Future<T>
Stop waiting for this future after timeLimit has passed.
inherited
toString() String
A string representation of this object.
inherited
whenComplete(FutureOr<void> action()) Future<T>
Registers a function to be called when this future completes.
inherited

Operators

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