registerState method

void registerState (S state)

Sets the underlying state object and registers this object's state listeners to be notified of updates to the state's stream.

Implementation

void registerState(S state) {
  if (identical(_state, state)) return;
  if (_state != null) _state.dispose();

  _state = state;
  _state.controller = this;

  _state.subscribeToMutations(onStateMutate,
      onError: onStateError, onDone: onStateDone);

  this.publishUpdate();
}