-
Notifications
You must be signed in to change notification settings - Fork 4
Transitions
Ricardo Canastro edited this page Mar 4, 2022
·
14 revisions
In order to transition between states, you'll need to dispatch events. Very often you'll need some metadata to go along with your events so that you can guard some transitions or apply some side effects.
To create an Automata event, all you'll have to do is to extend the abstract Event
class, and you're free to add any data that you want.
class Search extends Event {
final String query;
const Search(this.query);
}
On the following example, both the transition defined in the Off
and On
states are simple transitions.
final machine = StateMachine.create(
(g) => g
..initial<Off>()
..state<Off>(builder: (g) => g..on<OnToggle, On>())
..state<On>(builder: (g) => g..on<OnToggle, Off>())
);
TBA
TBA (talk about how a transition is picked)
TBA
TBA
TBA
TBA