cancellation_token library
Classes
-
CancellableCompleter<
T> - A Completer that can be cancelled using a CancellationToken.
-
CancellableFuture<
T> - A class for creating cancellable futures.
- CancellableIsolate
- A class for creating cancellable isolates.
- CancellationToken
- A token for controlling the cancellation of Cancellable operations.
- MergedCancellationToken
- Merges multiple cancellation tokens into a single token.
- TimeoutCancellationToken
- A CancellationToken that automatically cancels after a given duration.
Mixins
- Cancellable
- A mixin for making a class cancellable using a CancellationToken.
Extensions
Functions
-
cancellableCompute<
Q, R> (ComputeCallback< Q, R> callback, Q message, CancellationToken? cancellationToken, {String? debugLabel}) → Future<R> -
A cancellable implementation of Flutter's
compute()
method. -
cancellableFutureOr<
T> (FutureOr< T> computation(), CancellationToken? cancellationToken, {OnCancelCallback? onCancel}) → Future<T> - Converts a FutureOr to a cancellable Future.
-
ignoreCancellation(
FutureOr operation(), {FutureOr< void> onError(Object e, StackTrace stackTrace)?, FutureOr<void> whenComplete()?, FutureOr<void> whenCompleteOrCancelled()?}) → Future<void> -
Runs an operation and silently catches cancellations. Other exceptions can
be handled using
onError
. IfonError
is null, exceptions will be rethrown.
Typedefs
-
ComputeCallback<
Q, R> = FutureOr< R> Function(Q message) - Callback for cancellableCompute.
-
OnCancelCallback
= FutureOr<
void> Function() - Callback used for cancellables that accept an onCancel param.