Skip to main content
1 vote
1 answer
26 views

How to update a value of a UiState on a StateFlow?

Having this on my viewmodel: val uiState: StateFlow<BusStopsDBScreenUiState> = busDataRepository.getBusStops() .map<List<BusStop>, BusStopsDBScreenUiState> { busStops -> ...
NullPointerException's user avatar
1 vote
1 answer
26 views

Kotlin - why does my test on StateFlow return "stops by timeout"?

I am trying to better understand how StateFlow can be used by writing simple code in a scratch file in Android Studio. I just want to update a StateFlow and collect the result. The code is the ...
eqtèöck's user avatar
  • 1,065
0 votes
1 answer
37 views

How to use Flow in iOS from my kotlin repository?

In my KMM app, I have my kotlin shared code with this method: fun getUserProfile(): Flow<UserInfo?> = firestore.collection("UserInfo").document(auth.currentUser!!.uid)....
Cipri's user avatar
  • 284
1 vote
1 answer
27 views

My State Flow wont update the values in the viewmodel

I have this code for image analysis, and I'm trying to pass the processed text data list to the ViewModel. The text is recognized, but it doesn't get properly sent to the ViewModel. I logged the data, ...
Gábor Madový's user avatar
1 vote
1 answer
48 views

How to change the value of a repository Flow?

I came across this article: https://proandroiddev.com/loading-initial-data-in-launchedeffect-vs-viewmodel-f1747c20ce62 In this article, the author, while describing the advantages and disadvantages of ...
Sirop4ik's user avatar
  • 5,183
-2 votes
3 answers
63 views

Why can not fetch newest data through `.collectAsState()` method?

issue Can not fetch new data in .collectAsState() method, appeared in Code In LoadFoodItemInfo.kt The method is invoked. FoodItemRepository.setDatas(queriedFoodItemVOs) But after the above statement, ...
GeeksMathGeeks's user avatar
0 votes
0 answers
38 views

Jetpack Compose: What's the best practice for collecting StateFlow - in parent or child composable? [duplicate]

I have a Compose screen structure where ComposableA contains ComposableB and ComposableC. ComposableC needs data from a StateFlow in the ViewModel. I'm trying to determine the best approach for ...
Pawandeep Singh's user avatar
0 votes
2 answers
66 views

MutableStateFlow emission criteria explanation

I'm writing a simple todo app using compose and stateflow. data class Task( val name: String, val isCompleted: Boolean, val date: Long ) class SomeViewModel : ViewModel() { private ...
HukeLau_DABA's user avatar
  • 2,528
1 vote
1 answer
59 views

Collecting a flow does not produce any update

In a sample project I have a viewModel with two use cases. Both use cases call the same repository. One fetches via a flow a list of tasks that stores the repository in a StateFlow. The other provides ...
Diego's user avatar
  • 11
1 vote
1 answer
39 views

uiState doesn't update as expected

Whenever I trigger the "FavoritePost" or "DeletePost" and the uiState has TAB_TWO (Favorites) selected it either swaps to TAB_ONE, stays in TAB_TWO but displays all the Posts ...
Andrei-Alin Dulceanu's user avatar
3 votes
2 answers
103 views

View not updating after update to viewModel

I have the below list of items which has a checkbox next to each item in the form of a button. When the button is not selected, a black empty circle should show. When the button is selected there ...
GVG's user avatar
  • 609
4 votes
2 answers
89 views

Compose screen not recompositioning after state change

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 ...
juske's user avatar
  • 302
0 votes
0 answers
50 views

MutableStateFlow not being updated on @Composable

Currently I have a WebAppInterface that detects the events of the web, such WebAppInterface is called inside a @Composable WebView, inside the WebAppInterface I have a function that I have ...
Tony's user avatar
  • 357
1 vote
1 answer
83 views

How do I manage uiState for multiple sections?

I'm currently developing an Android app that displays multiple sections of movie lists. Each section's UI state is managed independently using separate StateFlows in the ViewModel. Here's a simplified ...
송규빈's user avatar
0 votes
1 answer
95 views

collect flow doesn't receive value from repository/usecase in viewmodel - android coroutines

I have a Repository + UseСase + ViewModel + MVI architecture. I have a UseCase for collecting Flow, and another UseCase to update Flow in repository When I go to the screen, collect fires and gives me ...
onesector's user avatar
  • 444

15 30 50 per page
1
2 3 4 5
20