Kotlin Flow Cheat Sheet

Cold & hot streams

Last Updated: November 21, 2025

Flow Types

Type Behavior
cold Restarts for each collector
hot Emits to multiple collectors
StateFlow State + default
SharedFlow Broadcast

Commands

flow.collect
Consume
flow.onEach
Side-effect
flow.stateIn
Cache

Guidance

Handle cancellations, buffer appropriately, and emit sporadic updates.

💡 Pro Tip: Prefer cold flows for data streams and share flows for caching.
← Back to Programming Languages | Browse all categories | View all cheat sheets