set method

void set({
  1. required TEnum to,
})

Change the current state of StateMachine instance to the specified TEnum state.

The state of a StateMachine instance is the first entry (TEnum.entry.index == 0) in the TEnum enumeration.

Implementation

void set({required final TEnum to}) {
  _index = _enumAsInt(to);
  _states[_index].reset();
}