CommandHandler<C extends Command, R> class abstract

A command handler is a class that handles a command and updates the state of the application. Extend this class to create a new handler for a command.

The C is the type of the command to handle. The R is the type of the state to update.

The handle method is used to handle the command and update the state. It will receive the command and the previous state as arguments and should return the new state. This method is called by the Mediator to handle the command. Remember to register the handler in the StateMediator before using the Mediator.

Constructors

CommandHandler()

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

handle(C command, R? previousState) → FutureOr<R?>
The method to handle the command and update the state. It will receive the command and the previous state as arguments and should return the new state. This method is called by the Mediator to handle the command.
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