debounceWithThrottle method
Implementation
void debounceWithThrottle(VoidCallback callback) {
_pendingCallback = callback;
final now = DateTime.now();
if (_lastThrottleRun == null ||
now.difference(_lastThrottleRun!) >= throttleDuration) {
_lastThrottleRun = now;
callback();
_debounceTimer?.cancel();
return;
}
_debounceTimer?.cancel();
_debounceTimer = Timer(debounceDelay, () {
_pendingCallback?.call();
});
}