google/dart-neats

Retry: Retry If Retruned Object Meets a Condition

Open

#45 opened on Jun 1, 2020

View on GitHub
 (8 comments) (4 reactions) (0 assignees)Dart (93 forks)auto 404
enhancementgood first issuepkg:retry

Repository metrics

Stars
 (508 stars)
PR merge metrics
 (PR metrics pending)

Description

Hi,

I'd like to retry if the returned object meets a condition.

Example:

      final response = await retry(
      // Make a GET request
      () => http.get('https://google.com'),
      // Retry on Exception
      retryIf: (e) => e is SocketException,
      retryIfReturnedObject: (o) => o == "retry-please"
  );

is this possible? Thanks

Contributor guide