CancelableOperation<T> class
Null safety
An asynchronous operation that can be cancelled.
The value of this operation is exposed as value. When this operation is cancelled, value won't complete either successfully or with an error. If value has already completed, cancelling the operation does nothing.
Constructors
-
CancelableOperation.fromFuture(Future<
T> result, {FutureOr onCancel()?}) -
Creates a CancelableOperation with the same result as the
result
future.factory
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- isCanceled → bool
-
Whether this operation has been canceled before it completed.
read-only
- isCompleted → bool
-
Whether the result of this operation is ready.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
-
value
→ Future<
T> -
The result of this operation, if not cancelled.
read-only
Methods
-
asStream(
) → Stream< T> - Creates a Stream containing the result of this operation.
-
cancel(
) → Future - Cancels this operation.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
then<
R> (FutureOr< R> onValue(T), {FutureOr<R> onError(Object, StackTrace)?, FutureOr<R> onCancel()?, bool propagateCancel = true}) → CancelableOperation<R> - Creates a new cancelable operation to be completed when this operation completes normally or as an error, or is cancelled.
-
toString(
) → String -
A string representation of this object.
inherited
-
valueOrCancellation(
[T? cancellationValue]) → Future< T?> - Creates a Future that completes when this operation completes or when it's cancelled.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromSubscription(
StreamSubscription< void> subscription) → CancelableOperation<void> -
Creates a CancelableOperation wrapping
subscription
. -
race<
T> (Iterable< CancelableOperation< operations) → CancelableOperation<T> >T> -
Creates a CancelableOperation that completes with the value of the first
of
operations
to complete.