run method

Future<List<HookResult>> run(
  1. List<HookStep> steps, {
  2. required String phase,
  3. required bool scopeSucceeded,
  4. Map<String, String> context = const {},
  5. Map<String, String> variableContext = const {},
})

Implementation

Future<List<HookResult>> run(
  List<HookStep> steps, {
  required String phase,
  required bool scopeSucceeded,
  Map<String, String> context = const {},
  Map<String, String> variableContext = const {},
}) async {
  final results = <HookResult>[];
  for (final step in steps) {
    if (phase == 'post' && !step.on.shouldRun(scopeSucceeded)) continue;
    final result = await _runOne(
      step,
      phase: phase,
      context: context,
      variableContext: variableContext,
    );
    results.add(result);
    if (!result.succeeded && !result.ignored) break;
  }
  return results;
}