dio_smart_retry 2.0.0-diox copy "dio_smart_retry: ^2.0.0-diox" to clipboard
dio_smart_retry: ^2.0.0-diox copied to clipboard

Retry library for Dio and DioX package made with love. By default, the request will be retried only for appropriate retryable http statuses.

example/dio_smart_retry_example.dart

import 'dart:async';

import 'package:diox/diox.dart';
import 'package:dio_smart_retry/dio_smart_retry.dart';

Future<dynamic> main() async {
  final dio = Dio();
  // Add the interceptor
  dio.interceptors.add(
    RetryInterceptor(
      dio: dio,
      logPrint: print, // specify log function (optional)
      retries: 4, // retry count (optional)
      retryDelays: const [
        // set delays between retries (optional)
        Duration(seconds: 1), // wait 1 sec before the first retry
        Duration(seconds: 2), // wait 2 sec before the second retry
        Duration(seconds: 3), // wait 3 sec before the third retry
        Duration(seconds: 4), // wait 4 sec before the fourth retry
      ],
    ),
  );

  /// Sending a failing request for 4 times from 1s to 4s
  await dio.get<dynamic>('https://mock.codes/500');
}
238
likes
0
pub points
98%
popularity

Publisher

verified publisherrodion-m.ru

Retry library for Dio and DioX package made with love. By default, the request will be retried only for appropriate retryable http statuses.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

diox, http_parser, path

More

Packages that depend on dio_smart_retry