cancel method

  1. @override
void cancel([
  1. dynamic reason
])
override

If the request is cancel then this will used to set the reason.

Implementation

@override
void cancel([dynamic reason]) {
  if (!isDone) {
    _logger.warning(
      '($_id) Request has been cancelled (reason: ${reason.runtimeType}).',
    );

    _cancel.complete(RequestCancelException(reason));

    if (_abortRequest != null) {
      _abortRequest!(
        RequestCancelException(
          reason,
        ),
      );
    }
  }
}