debounce method

void debounce({
  1. String? uniqueKey,
})

Implementation

void debounce({String? uniqueKey}) {
  String key = uniqueKey ?? hashCode.toString();
  Timer? timer = _funcDebounce[key];
  timer?.cancel();
  timer = Timer(Duration(milliseconds: timeout), () {
    Timer? t = _funcDebounce.remove(key);
    t?.cancel();
    target?.call();
  });
  _funcDebounce[key] = timer;
}