injectAction static method

void injectAction(
  1. dynamic action()
)

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

If the injection occurs too late to occur in the current tick, 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);
}