HookRegistration class
Registration record for a single hook handler.
Created when a hook is registered with HookExecutor.register and used to manage the hook's lifecycle (enable/disable/unregister).
Constructors
-
HookRegistration({required String id, required HookType type, HookPriority priority = HookPriority.normal, required String name, String? description, bool enabled = true, HookMatcher? matcher, HookHandler? handler, AsyncHookHandler? asyncHandler, String? source, Set<
String> tags = const {}, DateTime? registeredAt})
Properties
- asyncHandler → AsyncHookHandler?
-
The asynchronous handler function. Exactly one of handler or
asyncHandler must be non-null.
final
- description → String?
-
Optional description of what this hook does.
final
- enabled ↔ bool
-
Whether this hook is currently active.
getter/setter pair
- handler → HookHandler?
-
The synchronous handler function. Exactly one of handler or
asyncHandler must be non-null.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Unique identifier for this registration.
final
- isAsync → bool
-
Whether this hook uses an async handler.
no setter
- matcher → HookMatcher?
-
Optional matcher that filters which contexts trigger this hook.
If null, the hook fires for all contexts of the matching type.
final
- name → String
-
Human-readable name for debugging and logging.
final
- priority → HookPriority
-
Execution priority. Lower HookPriority.value runs first.
final
- registeredAt → DateTime
-
When this hook was registered.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source → String?
-
Source identifier (e.g., plugin name, "builtin", "user").
final
-
Tags for categorization and filtering.
final
- type → HookType
-
Which hook type this registration listens to.
final
Methods
-
execute(
HookContext context) → Future< HookResult> - Execute this hook's handler (sync or async) and return the result.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited