debounce2 static method
防抖 (传入所要防抖的方法/回调与延迟时间)
Implementation
static debounce2(Function func, [int delay = 500]) {
Timer? timer;
return () {
if (timer != null) {
timer?.cancel();
}
timer = Timer(Duration(milliseconds: delay), () {
func.call();
timer = null;
});
};
}