debounce function
Implementation
debounce(Function fn, [int t = 500]) {
Timer? _debounce;
return () {
if (_debounce?.isActive ?? false) {
_debounce?.cancel();
}
_debounce = Timer(Duration(milliseconds: t), () {
fn();
});
};
}