JSideEffectHandler<T extends JState> class
abstract
Handles side effects emitted by a JController.
JSideEffectHandler provides a mechanism to map side effect types to their corresponding handling logic. It connects the controller and the current UI BuildContext to process effects in a centralized, maintainable way.
Typically used within a widget to listen to the controller’s sideEffects stream.
Example usage:
final handler = MyEffectHandler(controller, context);
handler.register<ShowDialogEffect>((effect, controller) async {
final confirmed = await showDialog(...);
effect.complete(confirmed);
});
Constructors
-
JSideEffectHandler(JController<
T> controller, BuildContext context)
Properties
- context ↔ BuildContext
-
Reference to the UI context for handling effects.
latefinal
-
controller
↔ JController<
T> -
Reference to the controller emitting the side effects.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
handle(
JEffect effect, JController< T> controller) → Future<void> - Handles a given effect by invoking its corresponding registered handler.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register<
E extends JEffect> (Future< void> handler(E effect, JController<T> controller)) → void - Registers a handler for a specific type of JEffect.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited