State constructor
State(
- StateKey key, {
- TransitionHandler? onEnter,
- TransitionHandler? onExit,
- MessageHandler? onMessage,
- List<
TreeStateFilter> filters = const [],
Constructs a leaf state identified by key
.
A leaf state does not contain any child states.
The behavior of the state can be customized by providing onMessage
,
onEnter
, and onExit
handler functions.
A list of filters
can be provided in order to intercept the message and
transition handlers of the state. The filters will be applied to the
state in the order in which they appear in the list.
Implementation
factory State(
StateKey key, {
TransitionHandler? onEnter,
TransitionHandler? onExit,
MessageHandler? onMessage,
List<TreeStateFilter> filters = const [],
}) =>
State._((parent) {
return LeafNodeInfo(
key,
(_) => DelegatingTreeState(
onMessage: onMessage,
onEnter: onEnter,
onExit: onExit,
),
parent: parent,
isFinalState: false,
filters: filters,
);
});