CancelToken class

Controls cancellation of Dio's requests.

The same token can be shared between different requests. When cancel is invoked, requests bound to this token will be cancelled.

Constructors

CancelToken()

Properties

cancelError DioException?
If request have been canceled, save the cancel error.
no setter
hashCode int
The hash code for this object.
no setterinherited
isCancelled bool
Whether the token is cancelled.
no setter
requestOptions RequestOptions?
Corresponding request options for the request.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
whenCancel Future<DioException>
When cancelled, this future will be resolved.
no setter

Methods

cancel([Object? reason]) → void
Cancel the request with the given reason.
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

Static Methods

isCancel(DioException error) bool
Whether the error is thrown by cancel.