executeRegisteredLifecycleOperation method

Future<void> executeRegisteredLifecycleOperation(
  1. OperationDescriptor descriptor,
  2. Map<String, dynamic> input, {
  3. String? operationName,
  4. TestStep? step,
})

Executes lifecycle behavior selected by the already-validated registry descriptor, avoiding a second name-based dispatch pass.

Implementation

Future<void> executeRegisteredLifecycleOperation(
  OperationDescriptor descriptor,
  Map<String, dynamic> input, {
  String? operationName,
  TestStep? step,
}) async {
  if (descriptor.kind != OperationKind.lifecycle) {
    throw ArgumentError.value(
      descriptor.kind,
      'descriptor.kind',
      'Expected a lifecycle operation.',
    );
  }
  final name = operationName ?? descriptor.name;
  Future<void> beforeMutation() async {
    await emitLifecycleEvidenceBoundary(name, step: step);
  }

  await LifecycleActions.execute(
    this,
    descriptor,
    name,
    input,
    step: step,
    beforeMutation: beforeMutation,
  );
}