hisma_extra 0.1.1+9 hisma_extra: ^0.1.1+9 copied to clipboard
Extra classes on top of the Hisma hierarchical state machine implementation to simplify its usage.
Extra classes on top of Hisma to simplify Hisma usage.
This package intended to contain all classes that is built on top of hisma in order to simplify its usage.
Features #
- toggle state machine ([ToggleStateMachine])
Getting started #
Install hisma, hisma_extra and optionally any monitors (e.g. hisma_console_monitor or hisma_visual_monitor).
Usage #
Currently the single extra that is available for Hisma is the [ToggleStateMachine] class that creates a simle two states (on
and off
) state machine.
Create the machine:
final machine = ToggleStateMachine(name: 'toggleMachine');
Use the machine:
Future<void> play() async {
while (true) {
await Future<void>.delayed(const Duration(seconds: 1));
await machine.toggle();
}
}
Additional information #
If you have any questions, comments please go to Hisma GitHub Discussions to start or join discussions.