retry<T> method

Stream<T> retry <T>(
  1. Stream<T> streamFactory(
    1. [int count]

    Creates a Stream that will recreate and re-listen to the source Stream the specified number of times until the Stream terminates successfully.

    If the retry count is not specified, it retries indefinitely. If the retry count is met, but the Stream has not terminated successfully, a RetryError will be thrown. The RetryError will contain all of the Errors and StackTraces that caused the failure.


    Rx.retry(() => Stream.value(1))
        .listen((i) => print(i)); // Prints 1
      () => Stream.value(1).concatWith([Stream.error(Error())]),
    ).listen(print, onError: (e, s) => print(e)); // Prints 1, 1, RetryError


    static Stream<T> retry<T>(Stream<T> Function() streamFactory, [int count]) =>
        RetryStream<T>(streamFactory, count);