CancellationToken class

A CancellationToken is a mechanism for cooperative cancellation of asynchronous operations.

Properties

hashCode int
The hash code for this object.
no setterinherited
isCanceled bool
Returns true if the token is in a canceled state.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addHandler(FutureOr<void> handler()) FutureOr<void> Function()?
Adds and returns a handler if the token is not in the canceled state.
If the token is in the canceled state, the handler will be invoked immediately. In this case, the handler will not be added and null will be returned.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removerHandler(FutureOr<void> handler()?) → void
Removes the handler.
runCancelable<T>(void onCancel(), FutureOr<T> action()) Future<T>
Execute an action that can be canceled while it is being executed.
throwIfCanceled() → void
Throw the exception CancellationException if the token is in the canceled state.
toString() String
A string representation of this object.
inherited

Operators

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