cancel method

void cancel([
  1. dynamic reason
])

Cancel the request

Implementation

void cancel([dynamic reason]) {
  _cancelError = DioError(
    type: DioErrorType.cancel,
    error: reason,
    requestOptions: requestOptions ?? RequestOptions(path: ''),
  );
  _cancelError!.stackTrace = StackTrace.current;

  if (!_completer.isCompleted) {
    _completer.complete(_cancelError);
  }
}