Flow, SharedFlow, StateFlow Class Diagram
Kotlin Flow, SharedFlow, MutableSharedFlow, StateFlow, MutableStateFlow and FlowCollector class diagram
2 min readMay 13, 2023
This is part of the asynchronous flow series:
- Part 1 — Exploring Android LiveData Usages and Behaviors
- Part 2 — Introduction to Kotlin Flows and Channels
- Part 3 — Exploring Different Ways to Collect Kotlin Flow
- Part 4 — Convert Flow to SharedFlow and StateFlow
- Part 5 — Flow, SharedFlow, StateFlow Class Diagram
- Part 6 — Kotlin Flow — Combine, Merge and Zip
Since I’ve been playing around with asynchronous Kotlin flow in Android, I have to admit that the class relationship between all these flow classes is not clear even though I know how to use them.
Therefore, I drew this diagram below to get me to understand them.
There are a few things that I did not expect before I get to see this big picture.
- I didn’t know
StateFlow
extendsSharedFlow
interface. I thought there are completely…