ilkersevim_retry 0.1.2 copy "ilkersevim_retry: ^0.1.2" to clipboard
ilkersevim_retry: ^0.1.2 copied to clipboard

Add HTTP-client-neutral retries with backoff, jitter, cancellation, and injectable delays for deterministic Dart tests.

example/main.dart

import 'package:ilkersevim_retry/ilkersevim_retry.dart';

Future<void> main() async {
  const RetryPolicy policy = RetryPolicy(
    maxAttempts: 3,
    baseDelay: Duration(milliseconds: 1),
    jitter: false,
  );

  Future<void> immediateDelay(final Duration _) async {}

  int attempts = 0;
  final int result = await policy.executeWithRetry<int>(
    action: () async {
      attempts++;
      if (attempts < 3) {
        throw StateError('transient');
      }
      return attempts;
    },
    delay: immediateDelay,
  );

  print('succeeded after $result attempts');
}
1
likes
160
points
94
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Add HTTP-client-neutral retries with backoff, jitter, cancellation, and injectable delays for deterministic Dart tests.

Repository (GitHub)
View/report issues

Topics

#retry #async #dart

License

Apache-2.0 (license)

More

Packages that depend on ilkersevim_retry