CancelToken class Null safety

You can cancel a request by using a cancel token. One token can be shared with different requests. when a token's cancel method invoked, all requests with this token will be cancelled.

Constructors

CancelToken()

Properties

cancelError DioError?
If request have been canceled, save the cancel Error.
read-only
hashCode int
The hash code for this object.
read-onlyinherited
isCancelled bool
whether cancelled
read-only
requestOptions RequestOptions?
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
whenCancel Future<DioError>
When cancelled, this future will be resolved.
read-only

Methods

cancel([dynamic reason]) → void
Cancel the request
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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(DioError e) bool
Whether is throw by cancel