RetryConfig class

Configuration for the retry engine that guards remote image fetches.

Backoff is computed as delay * backoffMultiplier^attempt, optionally capped at maxDelay, with a small random jitter to avoid thundering-herd retries across many widgets failing at once.

Constructors

RetryConfig({int maxAttempts = 3, Duration delay = const Duration(seconds: 1), Duration maxDelay = const Duration(seconds: 30), double backoffMultiplier = 2.0, bool useJitter = true})
Creates a retry policy.
const

Properties

backoffMultiplier → double
Exponential growth factor applied per attempt.
final
delay → Duration
Base delay before the first retry.
final
hashCode → int
The hash code for this object.
no setterinherited
isEnabled → bool
Whether this policy permits any retries at all.
no setter
maxAttempts → int
Number of retries attempted after the initial request fails.
final
maxDelay → Duration
Upper bound for any single computed backoff delay.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
useJitter → bool
Whether to apply randomised jitter (0–25%) to each delay.
final

Methods

copyWith({int? maxAttempts, Duration? delay, Duration? maxDelay, double? backoffMultiplier, bool? useJitter}) → RetryConfig
Returns a copy with selected fields overridden.
delayForAttempt(int attempt, {double randomFactor = 0.0}) → Duration
Computes the delay before the retry numbered attempt (1-based).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

disabled → const RetryConfig
A policy that performs no automatic retries.