🐦 Kotlin Intermediate

What is Kotlin Flow?

Answer

Kotlin Flow is a cold asynchronous data stream that emits multiple values sequentially, as opposed to a suspend function which returns only a single value. "Cold" means a flow does not produce values until a collector subscribes to it, and each collector gets its own independent execution. Flow integrates naturally with coroutines and supports reactive operators like map, filter, transform, and combine. You collect a flow inside a coroutine with flow.collect { value -> }. For hot streams that share values among collectors, use StateFlow or SharedFlow.