debounce 0.1.0
debounce: ^0.1.0 copied to clipboard
A stream transformer for debouncing events that may happen to frequently
Debounce #
A stream transformer for debouncing events that may happen to frequently
Example #
import 'dart:async';
import 'package:debounce/debounce.dart';
main() {
var controller = new StreamController();
var transformer = new Debounce(new Duration(seconds: 5));
var debounced = controller.stream.transform(transformer);
// print the debounced events
debounced.listen(print);
// push a new event every second
new Timer.periodic(new Duration(seconds: 1), (_) {
controller.add("Streams are awesome!!!");
});
}