v2.0.8
dio_retry_plus
一个用于 dio 的插件,可重试失败的请求。
29喜欢 837近 30 天下载120Pub 分数
AndroidiOSWebmacOSWindowsLinux
SunnatilloShavkatov/dio_retry_plus open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
A plugin for dio that retries failed requests.
import 'package:dio_retry_plus/dio_retry_plus.dart';
final dio = Dio()
..interceptors.add(RetryInterceptor());
final dio = Dio()
..interceptors.add(RetryInterceptor(
options: const RetryOptions(
retries: 3, // Number of retries before a failure
retryInterval: const Duration(seconds: 1), // Interval between each retry
retryEvaluator: (error) => error.type != DioErrorType.CANCEL && error.type != DioErrorType.RESPONSE, // Evaluating if a retry is necessary regarding the error. It is a good candidate for updating authentication token in case of a unauthorized error (be careful with concurrency though)
)
)
);
final response = await dio.get("http://www.flutter.dev", options: Options(
extra: RetryOptions(
retryInterval: const Duration(seconds: 10),
).toExtra(),
));
final response = await dio.get("http://www.flutter.dev", options: Options(
extra: RetryOptions.noRetry().toExtra(),
));
final dio = Dio()
..interceptors.add(RetryInterceptor(logger: Logger("Retry")));
Please file issues.
依赖清单 4 项
{"sdk":"flutter"}^5.8.0+1{"sdk":"flutter"}^5.0.0先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗