'What is the hot flow and cold flow in coroutines and the difference between them?
I am mastering Kotlin coroutines and trying to figure out
1- what is hot flow and cold flow ?
2- what is the main difference between them?
3- when to use each one?
Solution 1:[1]
Form Here (+)
Cold vs Hot streams
Well, I really struggled with this concept because it is a little bit tricky. The main difference between cold and hot happened to be pretty simple: Hot streams produce when you don’t care while in cold streams, if you don’t collect() (or RxJava-s equivalent subscribe()) the stream won’t be activated at all. So, Flows are what we call cold streams. Removing the subscriber will not produce data at all, making the Flows one of the most sophisticated asynchronous stream API ever (in the JVM world).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Faz |
