RetryClient.withDelays constructor

RetryClient.withDelays(
  1. Client inner,
  2. Iterable<Duration> delays, {
  3. bool when(
    1. BaseResponse
    ) = _defaultWhen,
  4. bool whenError(
    1. Object,
    2. StackTrace
    ) = _defaultWhenError,
  5. 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, {
  bool Function(BaseResponse) when = _defaultWhen,
  bool Function(Object, StackTrace) whenError = _defaultWhenError,
  void Function(BaseRequest, BaseResponse?, int retryCount)? onRetry,
}) : this._withDelays(
        inner,
        delays.toList(),
        when: when,
        whenError: whenError,
        onRetry: onRetry,
      );