drainWithError method

void drainWithError(
  1. DioException error
)

Rejects all queued requests with the given error.

Implementation

void drainWithError(DioException error) {
  final pending = List.of(_queue);
  _queue.clear();
  for (final req in pending) {
    req.handler.reject(DioException(
      requestOptions: req.options,
      error: error.error,
      type: error.type,
      response: error.response,
    ));
  }
}