URetry class abstract

Retries a failing async job with growing waits (1s, 2s, 4s…). await URetry.run(() => api.load(), attempts: 3)

Constructors

URetry()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Static Methods

run<T>(Future<T> action(), {int attempts = 3, Duration delay = const Duration(seconds: 1), double factor = 2, Duration maxDelay = const Duration(seconds: 30), bool retryIf(Object error)?, void onRetry(Object error, int attempt)?}) → Future<T>
Calls action until it succeeds or attempts run out, then rethrows the last error; retryIf can stop early.