CancellableFuture<T> class

A class for creating cancellable futures.

For a shortcut to create a cancellable future, use CancellableFutureExtension.asCancellable.

Properties

future Future<T>
The cancellable future.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

delayed<T>(Duration duration, CancellationToken? cancellationToken, [FutureOr<T> computation()?, OnCancelCallback? onCancel]) Future<T>
Creates a future that runs its computation after a delay, unless cancelled.
from<T>(FutureOr<T> computation(), CancellationToken? cancellationToken, {OnCancelCallback? onCancel}) Future<T>
Creates a cancellable future containing the result of calling computation asynchronously with Timer.run.
microtask<T>(FutureOr<T> computation(), CancellationToken? cancellationToken, {OnCancelCallback? onCancel}) Future<T>
Creates a cancellable future containing the result of calling computation asynchronously with scheduleMicrotask.
sync<T>(FutureOr<T> computation(), CancellationToken? cancellationToken, {OnCancelCallback? onCancel}) Future<T>
Returns a future containing the result of immediately calling computation, unless cancelled.
value<T>(FutureOr<T> value, CancellationToken? cancellationToken, {OnCancelCallback? onCancel}) Future<T>
Returns a future that completes with the given value, unless cancelled.