throttle method

Observable<T> throttle (Stream window(T event), { bool trailing: false })

Emits only the first item emitted by the source Stream while window is open.

if trailing is true, then the last item is emitted instead

You can use the value of the last throttled event to determine the length of the next window.


new Stream.fromIterable([1, 2, 3])
  .throttle((_) => TimerStream(true, const Duration(seconds: 1)))


Observable<T> throttle(Stream window(T event), {bool trailing = false}) =>
    transform(ThrottleStreamTransformer<T>(window, trailing: trailing));