interval method

Stream<T> interval (
  1. Duration duration
)

Creates a Stream that emits each item in the Stream after a given duration.

Example

Stream.fromIterable([1, 2, 3])
  .interval(Duration(seconds: 1))
  .listen((i) => print('$i sec'); // prints 1 sec, 2 sec, 3 sec

Implementation

Stream<T> interval(Duration duration) =>
    transform(IntervalStreamTransformer<T>(duration));