throttleTime method

Observable<T> throttleTime (Duration duration, { bool trailing: false })

Emits only the first item emitted by the source Stream within a time span of duration.

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

Example

new Stream.fromIterable([1, 2, 3])
  .throttleTime(const Duration(seconds: 1))

Implementation

Observable<T> throttleTime(Duration duration, {bool trailing = false}) =>
    transform(ThrottleStreamTransformer<T>(
        (_) => TimerStream<bool>(true, duration),
        trailing: trailing));