Would you collect a Flow (not StateFlow) in a comp...
# compose
l
Would you collect a Flow (not StateFlow) in a composable or collect it in viewmodel and expose it as snapshot (MutableState) field? e.g. your business logic emits a constant flow of progress values to show a ProgressIndicator in UI
m
Why would you want to do that and make things complicated? Isn’t the progress naturally a state which happens to change over time? What would your ProgressIndicator show before it has received the first progress value. Just using a StateFlow looks much more natural to me. Just my two €ent.
l
@Michael Paus StateFlow:
Updates to the value are always conflated.
Conflation:
When a flow represents partial results of the operation or operation status updates, it may not be necessary to process each value, but instead, only most recent ones
Isnt that a problem?
m
Does it make a difference for a ProgressIndicator? I think not. It always displays the current value of your progress.
l
I guess skipping some values is negligibly. I will try it, thanks.