Decider<C, S, E> class final

Decides which events should happen for a command and state.

A decider is the core domain model for command handling: decide emits events and evolve folds those events back into state.

Implemented types
Available extensions

Constructors

Decider({required Decide<C, S, E> decide, required Evolve<S, E> evolve, required S initialState})
Creates a Decider.
const

Properties

decide Decide<C, S, E>
Function that emits events for a command and current state.
final
evolve Evolve<S, E>
Pure function that applies an event to a state.
final
hashCode int
The hash code for this object.
no setterinherited
initialState → S
State used before any events have been applied.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

combine<C2 extends CSuper, S2, E2 extends ESuper>(Decider<C2, S2, E2> other) Decider<CSuper, (S, S2), ESuper>

Available on Decider<C, S, E>, provided by the DeciderCombineExt extension

Combines two deciders into one tuple-state decider.
combineViaMerge<C2 extends CSuper, S2, E2 extends ESuper, SMerged>(Decider<C2, S2, E2> other, {required S leftState(SMerged state), required S2 rightState(SMerged state), required SMerged mergeState(S left, S2 right)}) Decider<CSuper, SMerged, ESuper>

Available on Decider<C, S, E>, provided by the DeciderCombineExt extension

Combines two deciders and merges their states into SMerged.
combineViaTuples<C2 extends CSuper, S2, E2 extends ESuper>(Decider<C2, S2, E2> other) Decider<CSuper, (S, S2), ESuper>

Available on Decider<C, S, E>, provided by the DeciderCombineExt extension

Combines two deciders and keeps their states as a tuple (S, S2).
dimapOnEvent<En>({required E fl(En), required En fr(E)}) Decider<C, S, En>

Available on Decider<C, S, E>, provided by the DeciderMapExt extension

Adapts this decider's event type in both directions.
dimapOnState<Sn>({required S fl(Sn), required Sn fr(S)}) Decider<C, Sn, E>

Available on Decider<C, S, E>, provided by the DeciderMapExt extension

Adapts this decider's state type in both directions.
mapLeftOnCommand<Cn>(C f(Cn)) Decider<Cn, S, E>

Available on Decider<C, S, E>, provided by the DeciderMapExt extension

Adapts this decider to accept another command type.
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