registerAction static method

void registerAction(
  1. int timestamp,
  2. dynamic action()
)

Registers an abritrary action to be executed at timestamp time.

The action, if it returns a Future, will be awaited.

Implementation

static void registerAction(int timestamp, dynamic Function() action) {
  if (timestamp <= _currentTimestamp) {
    throw Exception('Cannot add timestamp "$timestamp" in the past.'
        '  Current time is ${Simulator.time}');
  }
  if (!_pendingTimestamps.containsKey(timestamp)) {
    _pendingTimestamps[timestamp] = [];
  }
  _pendingTimestamps[timestamp]!.add(action);
}