/retry

A small library for handle retry with exponential backoff or max attemps

Primary LanguageDart

Getting started

A small library for handle retry with max attempts or exponential backoff

Usage

view /example folder for examples

  await withRetry(
    () => Future.error('error'),
    maxAttempts: 10,
    fallback: () => 1,
    backOffType: BackOffType.exponential,
    backOffDelay: Duration(seconds: 1),
    onRetry: () {},
    maxDelayBeetwenAttempts: Duration(seconds: 4),
  );

  await withRetryWhen(
    () => Future.error('error'),
    shouldRetryWhile: (exception) => exception is String,
    backOffType: BackOffType.fixed,
  );