EventHandler<TState extends State> class abstract

Base class for event handlers that apply events to update state Event handlers contain the logic for applying events to state

Implementers

Constructors

EventHandler()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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
canApply(Event event) bool
Check if this handler can apply the given event Override to provide custom event routing logic
checkInvariants(TState newState, Event event) bool
Check business invariants after applying event Override to implement domain-specific invariants
getCustomValidationErrors(TState currentState, Event event) List<String>
Override in subclasses to provide custom validation errors
getInvariantViolations(TState newState, Event event) List<String>
Get invariant violations Override to provide specific invariant violation messages
getValidationErrors(TState currentState, Event event) List<String>
Get validation errors for an event Override to provide custom validation errors
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
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

Operators

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