executeAsync method

Future<HookResult> executeAsync(
  1. HookType type,
  2. HookContext context
)

Execute all matching hooks for the given type asynchronously.

Runs the hook chain in priority order. Returns the final HookResult.

Implementation

Future<HookResult> executeAsync(HookType type, HookContext context) async {
  final chain = _chains[type];
  if (chain == null || chain.isEmpty) return const HookContinue();

  final hooks = chain.activeRegistrations;
  if (hooks.isEmpty) return const HookContinue();

  return _HookChainRunner.run(
    hooks: hooks,
    context: context,
    timeout: defaultTimeout,
    onEvent: _recordEvent,
  );
}