Observable<T>.repeat constructor

Observable<T>.repeat(Stream<T> streamFactory(int repeatIndex), [ 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.

Example

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

Implementation

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