cancelDeferred function

bool cancelDeferred(
  1. dynamic key, {
  2. String? category,
})

Cancels the deferred execution of the given key. Returns true if the task is not yet executed.

Implementation

bool cancelDeferred(key, {String? category}) {
  final di = _defers.remove(_DeferKey(key, category));
  if (di == null) return false;

  di.timer.cancel();
  return true;
}