events method

List<AppEvent> events(
  1. ScenarioRunStep step
)

The transition's events for step, typed — empty for a quiet transition, which is most of them.

Implementation

List<AppEvent> events(ScenarioRunStep step) {
  var path = step.events;
  if (path == null) return const [];
  var eventsFile = file(path);
  if (!eventsFile.existsSync()) return const [];
  return [
    for (var event in jsonDecode(eventsFile.readAsStringSync()) as List)
      if (event is Map) AppEvent.fromJson(event.cast<String, Object?>()),
  ];
}