retry<T> function

Future<T> retry<T>(
  1. FutureOr<T> function()
)

Run the function each time an exception is thrown until the retryCount is 0.

Implementation

Future<T> retry<T>(FutureOr<T> Function() function) async {

  // ignore: literal_only_boolean_expressions
  while (true) {
    try {
      return await function();
      // ignore: avoid_catches_without_on_clauses
    } on Exception {

    }
  }
}