Simple hierarchical state machine for Dart.