nextState method

  1. @protected
S? nextState(
  1. S? currentState,
  2. S update
)

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) {
  if (currentState == update) {
    _log.warning('broadcast has been rejected because the update is equal '
        'to the already set state. If you only want to rebuild'
        ' UI, use refresh() instead');
    return null;
  }

  return update;
}