injectAction static method

void injectAction(
  1. dynamic action()
)

Adds an arbitrary action to be executed as soon as possible, during the current simulation tick if possible.

If the injection occurs outside of a tick (SimulatorPhase.outOfTick), it will execute in a new tick in the same timestamp.

If action returns a Future, it will be awaited.

Implementation

static void injectAction(dynamic Function() action) {
  // adds an action to be executed in the current timestamp
  _injectedActions.addLast(action);
}