State getState(String name) { final state = _states[name]; if (state == null) { throw StateError('State not found: $name'); } return state; }