beforeRetry method

Future<HttpRequest?> beforeRetry(
  1. int attempt,
  2. HttpRequest request,
  3. HttpResponse? response,
  4. RhttpException? exception,
)

Called before each retry. May return a new request to be used for the current retry and all subsequent retries.

Implementation

Future<HttpRequest?> beforeRetry(
  int attempt,
  HttpRequest request,
  HttpResponse? response,
  RhttpException? exception,
) async {
  if (beforeRetryFunc != null) {
    return await beforeRetryFunc!.call(attempt, request, response, exception);
  }
  return null;
}