data/api/retry library

Classes

RetryConfig
Retry configuration.
RetryContext
Context tracked across retry attempts.
RetryDecision
Decision about whether to retry.

Functions

calculateRetryDelay({required int attempt, required RetryConfig config, String? retryAfterHeader}) Duration
Calculate delay for the next retry attempt.
shouldRetry({required ApiError error, required RetryContext context, required RetryConfig config}) RetryDecision
Determine whether an error should be retried.
withRetry<T>({required Future<T> operation(int attempt), RetryConfig config = RetryConfig.defaultConfig, void onRetry(int attempt, Duration delay, ApiError error)?}) Future<T>
Execute an operation with retry logic.