Kotlin Flow: Bugs That Look Correct at First
Comments
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Summary
The article walks through four common Kotlin Flow bugs that look correct at first glance: cold flows re-running upstream work per collector (fixed with shareIn), catch only handling upstream exceptions (not downstream ones), conflate() silently dropping intermediate values, and stateIn() with SharingStarted.WhileSubscribed never starting upstream without a subscriber, which matters…