RetryInterceptor class

An interceptor that will try to send failed request again

Constructors

RetryInterceptor({required Dio dio, dynamic logPrint(String message)?, int retries = 3, ToNoInternetPageNavigator? toNoInternetPageNavigator, List<Duration> retryDelays = const [Duration(seconds: 1), Duration(seconds: 2), Duration(seconds: 4)], RetryEvaluator? retryEvaluator})

Properties

dio → Dio
The original dio
final
hashCode int
The hash code for this object.
no setterinherited
logPrint → dynamic Function(String message)?
For logging purpose
final
retries int
The number of retry in case of an error
final
retryDelays List<Duration>
The delays between attempts. Empty retryDelays means no delay.
final
retryEvaluator RetryEvaluator?
Evaluating if a retry is necessary.regarding the error.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toNoInternetPageNavigator ToNoInternetPageNavigator?
ToNoInternetPage navigate
final

Methods

defaultRetryEvaluator(DioException error, int attempt) FutureOr<bool>
Returns true only if the response hasn't been cancelled or got a bas status code.
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.
onRequest(RequestOptions options, RequestInterceptorHandler handler) → void
Called when the request is about to be sent.
inherited
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