Why is the internal MutableStateFlow in a ViewModel declared…
Why is the internal MutableStateFlow in a ViewModel declared as private, while a separate read-only StateFlow is exposed (public) to the UI? For example: class AppViewModel : ViewModel() { private val _uiState = MutableStateFlow(AppUiState()) // read/write val uiState: StateFlow = _uiState.asStateFlow() // read-only …
Read Details