Observable<T>.repeat constructor

  1. Stream<T> streamFactory(
    1. int repeatIndex
  2. [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 count is not specified, it repeats indefinitely.


new RepeatStream((int repeatCount) =>
  Observable.just('repeat index: $repeatCount'), 3)
    .listen((i) => print(i)); // Prints 'repeat index: 0, repeat index: 1, repeat index: 2'


factory Observable.repeat(Stream<T> streamFactory(int repeatIndex),
        [int count]) =>
    Observable(RepeatStream<T>(streamFactory, count));