CanceledException class

Exception thrown when a task is canceled before execution

This exception is thrown when awaiting a TaskHandle that was canceled using TaskHandle.cancel before it started executing.

Example:

final limit = fLimit(1);

// Block the queue
limit(() async => longRunningTask());

// Queue a task
final handle = limit(() async => 'result');

// Cancel it before it runs
handle.cancel();

try {
  await handle;
} on CanceledException {
  print('Task was canceled');
}
Implemented types

Constructors

CanceledException(String message)
Creates a canceled exception with the given message

Properties

hashCode → int
The hash code for this object.
no setterinherited
message → String
The cancellation message
final
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.
override

Operators

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