What is the difference between cold and hot streams in Kotlin Flow?
Updated May 16, 2026
Short answer
Cold flows start on collection; hot flows emit continuously regardless of collectors.
Deep explanation
Cold Flow (default in Kotlin Flow) executes its block every time a collector subscribes, meaning each collector gets independent execution. Hot flows like StateFlow and SharedFlow emit values regardless of active collectors and maintain state or broadcast events. This distinction is crucial for designing reactive systems, especially in Android where UI state must survive configuration changes.
Unlock with a Pro subscription to view this section.
View pricingReal-world example
No real-world example available yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProCommon mistakes
No common mistakes listed yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProFollow-up questions
No follow-up questions available yet.
Unlock with a Pro subscription to view this section.
Upgrade to Pro