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
trueif the token is in acanceledstate.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
canceledstate.
If the token is in thecanceledstate, the handler will be invoked immediately. In this case, the handler will not be added andnullwill 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
actionthat can be canceled while it is being executed. -
throwIfCanceled(
) → void -
Throw the exception CancellationException if the token is in the
canceledstate. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited