debounceTime method

Stream<T> debounceTime(
  1. Duration duration
)

Transforms a Stream so that will only emit items from the source sequence whenever the time span defined by duration passes, without the source sequence emitting another item.

This time span start after the last debounced event was emitted.

debounceTime filters out items emitted by the source Stream that are rapidly followed by another emitted item.

Interactive marble diagram

Example

Stream.fromIterable([1, 2, 3, 4])
  .debounceTime(Duration(seconds: 1))
  .listen(print); // prints 4

Implementation

Stream<T> debounceTime(Duration duration) => transform(DebounceStreamTransformer<T>((_) => TimerStream<void>(null, duration)));