Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
41 views

I have two flows: activityState and activityUiState. I need the activityUiState to be of type MutableStateFlow, so I'm using the activityState as a Flow to update the value of the activityUiState. The ...
1 vote
1 answer
47 views

I have this code for image analysis, and I'm trying to pass the processed text data list to the view model. The text is recognized, but it doesn't get properly sent to the view model. I logged the ...
7 votes
5 answers
5k views

I am confused what to use, whether to use update or copy for changing/updating the state of UI in Jetpack Compose. Some say to use _uiState.update { it.copy() } Some say to use _uiState.value = ...
1 vote
1 answer
69 views

Is there a way to initialize a MutableStateFlow with data obtained from a database? I tried the following approach, but the recordedActivityUiState is not updated with the object from the ...
1 vote
1 answer
76 views

I have a viewModel, which has a property to indicate where is requesting. If it's true, then return, otherwise make a new request. private val _isLoading = MutableStateFlow(false) val ...
1 vote
1 answer
68 views

I have the following state sealed interface sealed interface MainState { data class Success( val hasUsername: Boolean = false, val isSessionActive: Boolean = false) : MainState ...
1 vote
2 answers
250 views

I'm working on a Jetpack Compose project where I use MutableStateFlow to display a Toast message when saving an article in the DetailScreen. However, when I navigate back to the previous screen using ...
4 votes
2 answers
137 views

I have a ViewModel with a stateFlow. Everytime that a button is clicked, I'm changing the value to the state but, for some reason, the screen is not reacting to that change. I know that the state's ...
1 vote
1 answer
82 views

I can change my view model's internal state by calling redirection(verified with Log statements), but it doesn't have any effect on gUiState in my main composable. Why is that? The main composable ...
0 votes
2 answers
114 views

`When I running my service, UI not update. Service is running because i see update in my log. This is my simplified example but still it doesn't work. My service has value MutableStateFlow, every 1 ...
2 votes
2 answers
153 views

Can someone tell me why otp value not updated by resetText? Steps: type some text in TextField click "Reset text" Is it bug or some issues with my code? ViewModel @HiltViewModel class ...
1 vote
2 answers
387 views

When working with MutableStateFlow in my viewmodel, I got the following compile error: "Type mismatch. Required: Bar, Found: Unit" Here is my stripped-down code: import androidx.lifecycle....