finalize method
Finalizes the debouncer: cancels the pending timer (if any) and
immediately runs the onWaited callbacks. Resets the started state
so that the next call will fire onStart again.
Implementation
FutureOr<void> finalize({FutureOr<void> Function()? onWaited}) {
final wasCancelled = cancel();
_hasStarted = false;
if (!wasCancelled) return null;
if (_onWaited != null) {
_sequencer.then(_convertHandler(_onWaited)).end();
}
if (onWaited != null) {
_sequencer.then(_convertHandler(onWaited)).end();
}
return _sequencer.completion.value;
}