v2.0.8
dio_retry_plus
Ein Plugin für Dio, das fehlgeschlagene Anfragen wiederholt.
29Likes 83730-Tage-Downloads120Pub-Punkte
AndroidiOSWebmacOSWindowsLinux
SunnatilloShavkatov/dio_retry_plus open-source repository details.
Englischer Projektschnappschuss. Aktuelle Inhalte auf 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.
Abhängigkeiten 4 Einträge
{"sdk":"flutter"}^5.8.0+1{"sdk":"flutter"}^5.0.0Nach Anwendungsfall filtern, Aktivität vergleichen und vor der Nutzung das Originalprojekt prüfen.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗