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.
example/hisma_extra_example.dart
import 'package:hisma/hisma.dart';
import 'package:hisma_extra/hisma_extra.dart';
import 'package:hisma_visual_monitor/hisma_visual_monitor.dart';
final machine = ToggleStateMachine(name: 'toggleMachine');
Future<void> play() async {
while (true) {
await Future<void>.delayed(const Duration(seconds: 1));
await machine.toggle();
}
}
void main(List<String> args) {
StateMachine.monitorCreators = [
(machine) => VisualMonitor(machine),
];
machine.start();
play();
}