Are there any good repos (code samples works fine ...
# android
v
Are there any good repos (code samples works fine as well) on github that will help me understand the difference between
StateFlow
and
SharedFlow
? I can't for the life of me understand this concept and when to use one over the other.
j
Official docs and… maybe the Keep or the coroutines issue have explanations and samples if I remember correctly. Elizarov published an article too
v
Where can I find those resources besides the docs? I found the article you mentioned here
j
Don’t remember the issue name, introduce stateflow or something so maybe
the author of that issue was elizarov too
p
A StateFlow is an implementation of ShareFlow where reply = 1, also important, it is conflated(will lose events if consumers process event slower than producers emit event) and also it wont emit if the new event is equal to the last emitted event, similar to apply distintcUntillChanged() on a flow
👍 1
m
Check this video by Ryan Pierce

https://www.youtube.com/watch?v=RoGAb0iWljg&t=775s