RetryClient.withDelays constructor

RetryClient.withDelays(
  1. Client inner,
  2. Iterable<Duration> delays, {
  3. FutureOr<bool> when(
    1. BaseResponse
    ) = _defaultWhen,
  4. FutureOr<bool> whenError(
    1. Object,
    2. StackTrace
    ) = _defaultWhenError,
  5. FutureOr<void> onRetry(
    1. BaseRequest,
    2. BaseResponse?,
    3. int retryCount
    )?,
})

Like new RetryClient, but with a pre-computed list of delays between each retry.

This will retry a request at most delays.length times, using each delay in order. It will wait for delays[0] after the initial request, delays[1] after the first retry, and so on.

Implementation

RetryClient.withDelays(
  Client inner,
  Iterable<Duration> delays, {
  FutureOr<bool> Function(BaseResponse) when = _defaultWhen,
  FutureOr<bool> Function(Object, StackTrace) whenError = _defaultWhenError,
  FutureOr<void> Function(BaseRequest, BaseResponse?, int retryCount)?
      onRetry,
}) : this._withDelays(
        inner,
        delays.toList(),
        when: when,
        whenError: whenError,
        onRetry: onRetry,
      );