call method

Future<void> call(
  1. ExecutionEvent event
)

Implementation

Future<void> call(ExecutionEvent event) async {
  if (!enabled) return;
  if (event.kind == ExecutionEventKind.attemptFinished) {
    // Failed or cancelled attempts may end with an active step that never
    // publishes stepFinished. Flush those snapshots from the same ordered
    // stream so normal and interrupted report paths share one owner.
    await flushAll();
    return;
  }
  if (event.stepIndex == null) return;
  final index = event.stepIndex!;
  switch (event.kind) {
    case ExecutionEventKind.stepStarted:
      final snapshot = await _capture();
      if (snapshot != null) _snapshots[index] = snapshot;
    case ExecutionEventKind.stepFinished:
      // Normal completion is owned by the event stream. Lifecycle cleanup
      // may still call flush for failure/compatibility paths, but the
      // snapshot is removed here so it cannot be persisted twice.
      await flush(index);
    default:
      break;
  }
}