CancelToken class

Provides cancel mechanism to upload process

Example:

final String cancelMessage = 'some cancel message';
final cancelToken = CancelToken(cancelMessage);
final future = client.upload.auto(
  UCFile(File('/some/file')),
  cancelToken: cancelToken,
);

Future.delayed(const Duration(milliseconds: 500), () => cancelToken.cancel());

try {
  await future;
} on CancelUploadException catch (e) {
  // cancelled
}

Constructors

CancelToken([String cancelMessage = ''])

Properties

cancelMessage String
Optional exception message
final
hashCode int
The hash code for this object.
no setterinherited
isCanceled bool
Indicates cancelled state
no setter
onCancel ↔ (void Function()?)
Internal property to handle cancel message DON'T USE IT IN YOUR CODE
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancel() → void
Call to cancel upload
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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