RetryInterceptor class

An interceptor that will try to send failed request again

Constructors

RetryInterceptor({required Dio dio, required void logPrint(String message), int retries = 1, RefreshTokenFunction? refreshTokenFunction, AccessTokenGetter? accessTokenGetter, ForbiddenFunction? forbiddenFunction, required ToNoInternetPageNavigator toNoInternetPageNavigator, List<Duration> retryDelays = const <Duration>[Duration(seconds: 1)]})

Properties

accessTokenGetter AccessTokenGetter?
Access token getter from storage
final
dio → Dio
The original dio
final
forbiddenFunction ForbiddenFunction?
refresh token functions get api client
final
hashCode int
The hash code for this object.
no setterinherited
logPrint → void Function(String message)
For logging purpose
final
refreshTokenFunction RefreshTokenFunction?
refresh token functions get api client
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
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toNoInternetPageNavigator ToNoInternetPageNavigator
ToNoInternetPage navigate
final

Methods

defaultRetryEvaluator(DioException error, int attempt) Future<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<void>
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