executeHooks method
Execute hooks for a specific stage
Implementation
Future<void> executeHooks(
HookStage stage,
String flagKey,
Map<String, dynamic>? context, {
dynamic result,
Exception? error,
EvaluationDetails? evaluationDetails,
HookHints? hints,
}) async {
final hookContext = HookContext(
flagKey: flagKey,
evaluationContext: context,
result: result,
error: error,
);
for (final hook in _hooks) {
try {
await _executeHookWithTimeout(
hook,
stage,
hookContext,
hook.metadata.config.timeout,
evaluationDetails,
hints,
);
} catch (e) {
if (_failFast || !hook.metadata.config.continueOnError) {
rethrow;
}
print('Error in ${hook.metadata.name} hook: $e');
}
}
}