ExponentialBackoffRetryPolicy constructor

ExponentialBackoffRetryPolicy({
  1. int maxAttempts = 5,
  2. Duration baseDelay = const Duration(seconds: 1),
  3. double factor = 2,
  4. Duration maxDelay = const Duration(seconds: 30),
  5. Duration jitter = const Duration(milliseconds: 100),
  6. Random? random,
})

Creates the policy.

maxAttempts is the total number of attempts (including the first). So with maxAttempts: 5, the caller will make 5 attempts before giving up.

Implementation

ExponentialBackoffRetryPolicy({
  this.maxAttempts = 5,
  this.baseDelay = const Duration(seconds: 1),
  this.factor = 2,
  this.maxDelay = const Duration(seconds: 30),
  this.jitter = const Duration(milliseconds: 100),
  Random? random,
}) : _random = random ?? Random();