throttleStream static method

Stream<UpdateNotification> throttleStream(
  1. Stream<UpdateNotification> input,
  2. Duration timeout, {
  3. UpdateNotification? addOne,
})

Throttle an UpdateNotification stream to trigger a maximum of once every timeout.

Use addOne to immediately send one update to the output stream.

Implementation

static Stream<UpdateNotification> throttleStream(
    Stream<UpdateNotification> input, Duration timeout,
    {UpdateNotification? addOne}) {
  return _throttleStream(
    input: input,
    timeout: timeout,
    throttleFirst: true,
    add: (a, b) => a.union(b),
    addOne: addOne,
  );
}