JMetaData<T extends JState> mixin
Provides optional metadata for JIntents to enhance observability and logging.
This mixin can be applied to any JIntent to expose descriptive information such as a human-readable name, intent type/category, and custom metadata.
It is especially useful in debugging tools, analytics, or logging systems that require additional context about dispatched intents.
Example:
class DecrementIntent extends JIntent<CounterState> with JMetaData {
@override
String get name => 'Decrement Counter';
@override
String get type => 'counter';
@override
Map<String, dynamic> get metadata => {
'timestamp': DateTime.now().toIso8601String(),
'origin': 'user_button',
};
}
- Superclass constraints
- JIntent<
T>
- JIntent<
Properties
-
controller
→ JController<
T> -
The controller bound by the most recent invocation.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isCancelled → bool
-
Whether cancellation was requested for the current execution.
no setterinherited
-
metadata
→ Map<
String, dynamic> -
Arbitrary key-value metadata to provide additional context.
no setter
- name → String
-
A descriptive name for the intent. Defaults to the class name.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → T
-
Provides easy access to the current state managed by the controller.
no setterinherited
- type → String
-
A category or type identifier for grouping intents.
By default, returns the runtimeType of the implementing class.
no setter
Methods
-
cancel(
) → void -
Requests cooperative cancellation of the execution in progress.
inherited
-
invoke(
JController< T> controller) → Future<void> -
Wires the controller before executing the logic. Not overridable;
override onInvoke instead. An instance can be reused after completion,
but overlapping invocations fail with StateError before rebinding it.
Invoking against a disposed controller also fails with StateError.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onInvoke(
) → Future< void> -
Contains the core logic of the intent.
inherited
-
run(
JController< T> controller) → Future<void> -
Executes the intent. Not overridable; override onInvoke instead.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited