cancel method Null safety

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;
  _completer.complete(_cancelError);
}