nextState method
Called to calculate the new state
This function takes currentState and the planned update state
and returns the state which would be broadcast and will become the current state
Originally it just discards the current state and returns the update as the next state.
This behavior can of course be overridden
If this function returns null, nothing will be broadcast
Implementation
@protected
S? nextState(S? currentState, S update) {
return update;
}