updateState method

void updateState(
  1. CubitStateEntity newState
)

Implementation

void updateState(CubitStateEntity newState) {
  final states = {...state.states};
  assert(states.containsKey(newState.id), 'State not found');
  states[newState.id] = newState;
  emit(
    state.copyWith(
      states: states,
      stateHistory: [
        ...state.stateHistory,
        newState,
      ],
    ),
  );
}