updateUserSelections method

void updateUserSelections(
  1. UserSelectionState stateUpdate(
    1. UserSelectionState previousState
    )
)

Update the current userSelectionState. The callback stateUpdate receives the actual version of the state and should return the updated version. If the returned state is the same as before, no update is triggered.

Implementation

void updateUserSelections(
  UserSelectionState Function(UserSelectionState previousState) stateUpdate,
) {
  userSelections.value = stateUpdate(userSelections.value);
}