onCubitChanged method

void onCubitChanged(
  1. CubitEntity updatedVariable
)

Implementation

void onCubitChanged(CubitEntity updatedVariable) {
  /// Check if the variable is in the state
  assert(state.cubits.containsKey(updatedVariable.id));

  final temp = {...state.instantiatedCubits};
  temp[updatedVariable.id] = updatedVariable;

  /// Check if the state has changed
  assert(checkEquality(temp, state.instantiatedCubits) == false);

  emit(state.copyWith(instantiatedCubits: temp));
  _cubitUpdateController
      .add(CubitUpdate(updatedVariable.id, updatedVariable));
}