-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add StateFlow and MutableStateFlow support #109
Comments
Hi!. Do you mean changing the KStore's |
Yes, but after a lot of thought, I think an easier option would be to include an example of how you properly generate a |
Hi @robertjamison. I have some examples in my NYTimes app - but in that case I'm using molecule, so it might not work for your usecase Coversion to StateFlow should be easy but requires some configurations to be made from the use-site val playerFlow: StateFlow<Player?> = userStore.updates.stateIn(coroutineScope, SharingStarted.Lazily, null) Here I'm making the following configurations
val Loading: Nothing? = null
val playerFlow: StateFlow<Player?> = userStore.updates.stateIn(coroutineScope, SharingStarted.Lazily, Loading)
|
Flows require the direct statement of a
CoroutineScope
,stateIn
, orcollect()
to properly access the data in acomposable
'sLaunchedEffect
. This is a lot of effort, andFlows
are considered a cold state once completed.Based on JetBrains' shift towards
StateFlow
andSharedFlow
, I recommend adding a way to use both of these datatypes to the API, as well as theirmutable
versions a feature of the next update.The text was updated successfully, but these errors were encountered: