run method

Future<void> run(
  1. DynamicAction action,
  2. ActionHandler handler
)

Run a single action or action_group. For action_group, runs sub-actions sequentially or in parallel; handler receives only single actions.

Implementation

Future<void> run(DynamicAction action, ActionHandler handler) async {
  if (action.type == ActionType.actionGroup) {
    if (action.executionMode == ActionExecutionMode.sequential) {
      for (final a in action.actions) {
        await run(a, handler);
      }
    } else {
      await Future.wait(action.actions.map((a) => run(a, handler)));
    }
    return;
  }
  await handler.handle(action);
}