repeat<T> static method
Creates a Stream that will recreate and re-listen to the source Stream the specified number of times until the Stream terminates successfully.
If count
is not specified, it repeats indefinitely.
Example
RepeatStream((int repeatCount) =>
Stream.value('repeat index: $repeatCount'), 3)
.listen((i) => print(i)); // Prints 'repeat index: 0, repeat index: 1, repeat index: 2'
Implementation
static Stream<T> repeat<T>(Stream<T> Function(int repeatIndex) streamFactory,
[int? count]) =>
RepeatStream<T>(streamFactory, count);