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
-
- Future<
T>
- Future<
- Available extensions
Constructors
-
Until(ReadableNode<
T> source, bool predicate(T value), {bool? detach}) -
Creates an Until that waits for
sourceto satisfypredicate.factory -
Until.changed(ReadableNode<
T> source, {bool? detach}) -
Creates an Until that waits for
sourceto change from its current value.factory -
Until.when(ReadableNode<
T> source, T value, {bool? detach}) -
Creates an Until that waits for
sourceto equalvalue.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<
A JSPromise that either resolves with the result of the completed Future or rejects with an object that contains its error.T> , provided by the FutureOfJSAnyToJSPromise extensionno setter -
toJS
→ JSPromise<
JSAny?> -
Available on Future<
A JSPromise that either resolves once this Future completes or rejects with an object that contains its error.void> , provided by the FutureOfVoidToJSPromise extensionno 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<
Completely ignores this future and its result.T> , provided by the FutureExtensions extension -
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<
Handles errors on this future.T> , provided by the FutureExtensions extension -
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
timeLimithas 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