MessageContext class abstract
Provides information to a state about the message that is being processed.
This context is provided as an argument to TreeState.onMessage. In addition to providing
access to the message that is being processed, it has several methods that allow a message
handler to indicate the result its processsing. For example, the handler can indicate that a
state transition should occur by calling goTo, or that message processing should be delegated
to its parent state by calling unhandled.
- Available extensions
Constructors
Properties
-
appData
→ Map<
String, Object> -
A map for storing application data.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → Object
-
The message that is being processed by the state machine.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
data<
D> ([StateKey? key]) → DataValue< D> ? -
Gets the DataValue matching the type
DandstateKeyfrom the current state, or one of its ancestor states. -
dataOrThrow<
D> ([StateKey? key]) → DataValue< D> -
Available on MessageContext, provided by the MessageContextExtensions extension
-
dataValueOrThrow<
D> ([StateKey? key]) → D -
Available on MessageContext, provided by the MessageContextExtensions extension
-
goTo(
StateKey targetStateKey, {TransitionHandler? transitionAction, Object? payload, bool reenterTarget = false}) → MessageResult - Returns a MessageResult indicating that a transition to the specified state should occur.
-
goToSelf(
{TransitionHandler? transitionAction}) → MessageResult - Returns a MessageResult indicating that a self-transition should occur.
-
messageAsOrThrow<
M> () → M -
Available on MessageContext, provided by the MessageContextExtensions extension
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
post(
FutureOr< Object> message) → void - Posts a message that should be dispatched to the state machine asynchronously.
-
schedule(
Object message(), {Duration duration = const Duration(), bool periodic = false}) → Dispose - Schedules a message to be dispatched to the state machine asynchronously.
-
stay(
) → MessageResult - Returns a MessageResult indicating that an internal transition should occur.
-
toString(
) → String -
A string representation of this object.
inherited
-
unhandled(
) → MessageResult - Returns a MessageResult indicating the message could not be handled by a state, and that its parent state should be given an opportunity to handle the message.
-
updateOrThrow<
D> (D update(D current), {StateKey? key}) → D -
Available on MessageContext, provided by the MessageContextExtensions extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited