DebounceStreamTransformer<T> class

Transforms a Stream so that will only emit items from the source sequence if a window has completed, without the source sequence emitting another item.

This window is created after the last debounced event was emitted. You can use the value of the last debounced event to determine the length of the next window.

A window is open until the first window event emits.

The debounce StreamTransformer 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
Inheritance

Constructors

DebounceStreamTransformer(Stream window(T event))
Constructs a StreamTransformer which buffers events into a List and emits this List whenever the current window fires.

Properties

closeWindowWhen bool Function(List<T> queue)?
Predicate which determines when the current window should close
finalinherited
dispatchOnClose bool
Toggle to prevent, or allow the final set of events to be dispatched when the source Stream closes
finalinherited
hashCode int
The hash code for this object.
no setterinherited
ignoreEmptyWindows bool
Toggle to prevent, or allow windows that contain no events to be dispatched
finalinherited
maxLengthQueue int?
Maximum length of the buffer. Specify this value to avoid running out of memory when adding too many events to the buffer. If it's null, maximum length of the buffer is unlimited.
finalinherited
onWindowEnd → T Function(List<T> queue)?
Handler which fires when the window closes
finalinherited
onWindowStart → T Function(T event)?
Handler which fires when the window opens
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startBufferEvery int
Used to skip an amount of events
finalinherited
strategy WindowStrategy
Determines how the window is created
finalinherited
windowStreamFactory Stream Function(T event)?
Factory method used to create the Stream which will be buffered
finalinherited

Methods

bind(Stream<T> stream) Stream<T>
Transforms the provided stream.
inherited
cast<RS, RT>() StreamTransformer<RS, RT>
Provides a StreamTransformer<RS, RT> view of this stream transformer.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited