RetryConfig constructor

RetryConfig({
  1. required RetryStrategy strategy,
  2. int maxAttempts = 3,
  3. Duration? initialDelay,
  4. Duration? maxDelay,
  5. bool enableJitter = true,
  6. double jitterFactor = 0.2,
  7. List<int>? retryableStatusCodes,
  8. void onRetry(
    1. int attemptNumber,
    2. DioException error,
    3. Duration delay
    )?,
  9. bool retryOnlyNetworkErrors = false,
})

Implementation

RetryConfig({
  required this.strategy,
  this.maxAttempts = 3,
  this.initialDelay,
  this.maxDelay,
  this.enableJitter = true,
  this.jitterFactor = 0.2,
  List<int>? retryableStatusCodes,
  this.onRetry,
  this.retryOnlyNetworkErrors = false,
}) : retryableStatusCodes =
         retryableStatusCodes ??
         [
           408, // Request Timeout
           429, // Too Many Requests
           500, // Internal Server Error
           502, // Bad Gateway
           503, // Service Unavailable
           504, // Gateway Timeout
         ];