althaf
03/21/2022, 10:21 AMclass LoginViewModel : ViewModel() {
val registeredUsers = mutableStateListOf<UIRegisteredUser>()
in the view model
1. Is there way to protect this registeredUsers list from updating the object values from other than view model ? I'm tryting to avoid accidental modification these values from out side view model, trying to keep vm as single source of truth.annsofi
03/21/2022, 12:59 PMprivate set
on it, that way only the LoginViewModel will be allowed to change it.Alex Vanyo
03/21/2022, 3:58 PMmutableStateListOf
from the ViewModel
as just a normal List
instead of a MutableList
, then anything outside of the ViewModel
won’t be able to change the list.