resume method
void
resume()
Resumes the debouncer, scheduling pending actions if necessary.
Implementation
void resume() {
_ensureNotDisposed();
if (!_isPaused) return;
_isPaused = false;
final now = DateTime.now();
final remainingMaxWait = _remainingMaxWaitOnPause;
final maxWait = _maxWait;
// Reconstruct timestamps so remaining getters line up with timers.
if (_remainingDelayOnPause != null && _lastCallTime != null) {
_lastCallTime = now.subtract(_delay - _remainingDelayOnPause!);
}
if (maxWait != null && remainingMaxWait != null && _firstCallTime != null) {
_firstCallTime = now.subtract(maxWait - remainingMaxWait);
}
// Re-schedule timers if a pending action exists.
if (_lastAction != null) {
_timer = _timerFactory(_remainingDelayOnPause ?? _delay, () {
if (!_immediate && _lastAction != null) {
_executeAction(_lastAction!);
}
_cancelTimers();
});
if (maxWait != null && remainingMaxWait != null) {
_maxWaitTimer = _timerFactory(remainingMaxWait, () {
if (_lastAction != null) {
_executeAction(_lastAction!);
}
_cancelTimers();
});
}
}
_remainingDelayOnPause = null;
_remainingMaxWaitOnPause = null;
_logDebug('Debouncer resumed.');
_publishState();
}