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 ↗