CompositeEventHandler<TState extends State> class

Composite event handler that delegates to multiple handlers

Inheritance

Constructors

CompositeEventHandler(List<EventHandler<TState>> _handlers)

Properties

handlers List<EventHandler<TState>>
Get all handlers
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addHandler(EventHandler<TState> handler) → void
Add a handler to the composite
apply(TState currentState, Event event) → TState
Apply an event to the current state and return the new state This is the core method that updates state based on events
override
canApply(Event event) bool
Check if this handler can apply the given event Override to provide custom event routing logic
override
checkInvariants(TState newState, Event event) bool
Check business invariants after applying event Override to implement domain-specific invariants
inherited
getCustomValidationErrors(TState currentState, Event event) List<String>
Override in subclasses to provide custom validation errors
inherited
getInvariantViolations(TState newState, Event event) List<String>
Get invariant violations Override to provide specific invariant violation messages
inherited
getValidationErrors(TState currentState, Event event) List<String>
Get validation errors for an event Override to provide custom validation errors
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
process(TState currentState, Event event) EventResult<TState>
Apply an event with full validation and error handling This is the main entry point for event application
inherited
removeHandler(EventHandler<TState> handler) → void
Remove a handler from the composite
toString() String
A string representation of this object.
inherited
validateEvent(TState currentState, Event event) bool
Validate an event before applying Override to provide custom validation logic
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited