onEnterWithPrevious method
Registers a callback invoked when entering this state type, receiving
the previous state (or null if there was none). Only fires if the
previous state is not also of type TDerived.
Implementation
void onEnterWithPrevious(ValueCallback<TState?> handler) {
_internalState
.onEnter<TDerived>((previous) => handler(previous as TState?));
}