This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_uiState.update { it.copy(title = "Something") } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_uiState.value = _uiState.value.copy(title = "Something") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExampleViewModel( | |
private val initialState: ExampleViewState | |
) : ViewModel() { | |
private val _uiState: MutableStateFlow<ExampleViewState> = MutableStateFlow(initialState) | |
val uiState = _uiState.asStateFlow() | |
} | |
data class ExampleViewState( | |
val title: String = "", | |
val description: String = "" |