Channel<P> class
Indicates that a value of type P must be provided when entering a state.
Channels are intended as a contract indicating that in order to transition to a particular
state, additional contextual information of type P must be provided by the transition source.
// In order to enter the authenticating state, a SubmitCredentials value is
// required.
var authenticatingChannel = Channel<SubmitCredentials>(States.authenticating);
treeBuilder.state(States.loginEntry, (b) {
b.onMessage<SubmitCredentials>((b) {
// Provide a SubmitCredentials value when entering authenticating state
b.enterChannel(authenticatingChannel, (_, msg) => msg);
});
}, parent: States.login);
treeBuilder.state(States.authenticating, (b) {
b.onEnterFromChannel<SubmitCredentials>(authenticatingChannel, (b) {
// The builder argument provides access to the SubmitCredentials, in this
// case as as argument to the getMessage function
b.post<AuthFuture>(getMessage: (_, creds) => _login(creds, authService));
});
}, parent: States.login)
Properties
Methods
-
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