RetryInterceptor class
重试拦截器
Constructors
-
RetryInterceptor({required Dio dio, dynamic logPrint(String message)?, int retries = 3, List<
Duration> retryDelays = const [Duration(seconds: 1), Duration(seconds: 3), Duration(seconds: 5)], RetryEvaluator? retryEvaluator, bool ignoreRetryEvaluatorExceptions = false})
Properties
- dio → Dio
-
Dio 对象
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- ignoreRetryEvaluatorExceptions → bool
-
是否忽略异常
final
- logPrint → (dynamic Function(String message)?)
-
打印方法
final
- retries → int
-
重新请求次数
final
-
retryDelays
→ List<
Duration> -
重试时间间隔
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(
DioError err, ErrorInterceptorHandler handler) → Future - The callback will be executed on error.
-
onRequest(
RequestOptions options, RequestInterceptorHandler handler) → void -
The callback will be executed before the request is initiated.
inherited
-
onResponse(
Response response, ResponseInterceptorHandler handler) → void -
The callback will be executed on success.
If you want to continue the response, call
handler.next
.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
defaultRetryEvaluator(
DioError error, int attempt) → FutureOr< bool> - 默认判断重试的条件