stream_transform
stream_transform copied to clipboard
Enforcing a minimum wait time between emissions without delaying the first
Given a stream with events at t = 0, 1, 2, 5, 6
, is there a way to transform this into a stream where each event adds a 2 second hold until the next event is emitted?
I tried .asyncMapBuffer((events) => Future.delayed(const Duration(seconds: 2), () => events.last))
, but that adds an unwanted 2 second delay to the very first event, too.