When should we use StateFlow or SharedFlow instead...
# coroutines
k
When should we use StateFlow or SharedFlow instead of regular flow?
m
Use SharedFlow if you want multiple consumers for the same producer. Use StateFlow if you need access the the last emitted value
👍 4
k
Do
.stateIn
and
.sharedIn
optimize the flow as the have SharingStarted logic?