createDebounceFunc<T> static method
- @internal
Implementation
@internal
static Function(T) createDebounceFunc<T>(
Function(T) f, {
Function(Function)? cancelFunc,
required Duration wait,
}) {
Timer? t;
return (p) {
t?.cancel();
t = Timer(wait, () {
t = null;
f(p);
});
// pass back the cancel method so we can cancel it when no longer needed
cancelFunc?.call(t!.cancel);
};
}