debounce<T> method

void debounce<T>(
  1. dynamic fn(
    1. T arg
    ),
  2. Duration duration,
  3. T dep
)

Implementation

void debounce<T>(Function(T arg) fn, Duration duration, T dep) {
  final timer = call((_) {
    return Timer(duration, () {
      fn(dep);
    });
  }, dep);

  dispose(_cancelTimer, timer);
}