RetryPolicy constructor

const RetryPolicy({
  1. int maxRetries = 3,
  2. BackoffStrategy backoff = const ExponentialBackoff(),
  3. bool shouldRetry(
    1. Object error,
    2. int attempt
    )?,
})

Creates a RetryPolicy.

  • maxRetries — maximum number of retry attempts (default 3).
  • backoff — strategy that computes the delay between retries.
  • shouldRetry — optional predicate; if provided, only errors for which this returns true are retried. By default everything is retryable.

Implementation

const RetryPolicy({
  this.maxRetries = 3,
  this.backoff = const ExponentialBackoff(),
  this.shouldRetry,
});