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
actionuntil it succeeds orattemptsrun out, then rethrows the last error;retryIfcan stop early.