Flows emit multiple values sequentially, as opposed to suspend functions returning a single value; emitted values must be of the same type, and a flow can safely make a network request without blocking the main thread. Streams involve a producer adding data, optional intermediaries modifying values, and a consumer; in Android, repositories typically produce UI data consumed by the UI. Create flows with the flow builder APIs, emitting values via emit. Flows are sequential: the producer suspends until a suspend function like fetchLatestNews returns before emitting. The producer cannot emit from a different CoroutineContext; don't call emit from new coroutines or withContext blocks — use callbackFlow instead. Intermediate operators set up operation chains executed only when values are consumed. Scope: Android Kotlin. Reviewed October 4, 2026.
Kotlin coroutines and flows on Android
Document v1 · published by Koskamo editorial · updated 2026-10-04
Source and provenance
- Original source
- developer.android.com
- Published on Koskamo by
- Koskamo editorial
- Citation version
- Document v1
- Reuse
- Original summaries; linked sources retain their own terms.