debounce method
Debounces a callback function.
id: A unique identifier for this operation.duration: The silence duration required before execution.callback: The function to execute.
Each call resets the timer. The callback runs only after duration
has passed without any new calls.
Implementation
void debounce(String id, Duration duration, void Function() callback) {
_timers[id]?.cancel();
_timers[id] = Timer(duration, () {
_timers.remove(id);
callback();
});
}