debounceTime method
Implementation
Stream<T> debounceTime(Duration duration) {
Timer? timer;
return transform(StreamTransformer.fromHandlers(
handleData: (T data, EventSink<T> sink) {
timer?.cancel();
timer = Timer(duration, () => sink.add(data));
},
handleDone: (EventSink<T> sink) {
timer?.cancel();
sink.close();
},
));
}