RetryInterceptor class

An interceptor that will try to send failed request again

Inheritance

Constructors

RetryInterceptor({required Dio dio, void logPrint(String message)?, int retries = 3, List<Duration> retryDelays = const [Duration(seconds: 1), Duration(seconds: 3), Duration(seconds: 5)], RetryEvaluator? retryEvaluator, bool ignoreRetryEvaluatorExceptions = false, Set<int> retryableExtraStatuses = const {}})

Properties

dio Dio
The original dio
final
hashCode int
The hash code for this object.
no setterinherited
ignoreRetryEvaluatorExceptions bool
Ignore exception if _retryEvaluator throws it (not recommend)
final
logPrint → void Function(String message)?
For logging purpose
final
retries int
The number of retry in case of an error
final
retryableExtraStatuses Set<int>
Specifies an extra retryable statuses, which will be taken into account with defaultRetryableStatuses IMPORTANT: THIS SETTING WORKS ONLY IF _retryEvaluator is null
final
retryDelays List<Duration>
The delays between attempts. Empty retryDelays means no delay.
final
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
onError(DioException err, ErrorInterceptorHandler handler) Future
Called when an exception was occurred during the request.
override
onRequest(RequestOptions options, RequestInterceptorHandler handler) → void
Called when the request is about to be sent.
override
onResponse(Response response, ResponseInterceptorHandler handler) → void
Called when the response is about to be resolved.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

defaultRetryEvaluator FutureOr<bool> Function(DioException error, int attempt)
Redirects to DefaultRetryEvaluator.evaluate with defaultRetryableStatuses
final