cancelAction static method

bool cancelAction(
  1. int timestamp,
  2. dynamic action()
)

Cancels an action previously scheduled for timestamp.

Returns true iff a action was previously registered at timestamp.

Implementation

static bool cancelAction(int timestamp, dynamic Function() action) {
  if (!_pendingTimestamps.containsKey(timestamp)) {
    return false;
  }

  if (!_pendingTimestamps[timestamp]!.remove(action)) {
    return false;
  }

  if (_pendingTimestamps[timestamp]!.isEmpty) {
    _pendingTimestamps.remove(timestamp);
  }

  return true;
}