AAndroid Expert·Nov 2Why Your Flow Refuses to Hop Threads: Context Preservation, flowOn, and channelFlow in KotlinWhy withContext breaks flow { } in Kotlin. Learn context preservation, when to use flowOn or channelFlow, and the Android failures that crash apps.11 min read·android-expert.hashnode.dev1
AAndroid Expert·Nov 2Dropped on the Floor: Conflation in Kotlin Flows and the UI Events You Never SawLearn how Kotlin Flow conflation drops events in StateFlow, SharedFlow, and collectLatest, and fix it with Channels, buffers, and tested patterns.11 min read·android-expert.hashnode.dev
MManuel Alejandro Hermoso·Oct 13An AI agent that asks before it pays: human approval for tool calls in Kotlin Build a Kotlin AI agent that pauses before a tool call and waits for a person to approve it. The pause survives a restart, and the tests need no model9 min read·deeptelar.hashnode.dev
GGanesh Rama Hegde·Feb 23Chapter 1 : UseCase01 - Coroutine Builders and Execution Semantics Mental Model: What Is a Coroutine? A coroutine is a suspendable computation, represented as a state machine, executed under a Job, scheduled by a dispatcher and resumed via a continuation. It is not a13 min read·kotlindeepdive.hashnode.dev
GGanesh Rama Hegde·Feb 21Chapter 30 : UseCase27 - Flow Cancellation & Cooperative Cancellation Flow cancellation is not an optional feature. It is a core part of how coroutines are designed to behave. When a collector stops collecting, the entire upstream flow is cancelled automatically. This i6 min read·kotlinflow.hashnode.dev
GGanesh Rama Hegde·Feb 20Chapter 27 : UseCase24 - StateFlow (State Holder Semantics)What is StateFlow? StateFlow is a special type of SharedFlow that: Always holds a current value Requires an initial value Replays the latest value to new collectors Conflates updates automatically3 min read·kotlinflow.hashnode.dev
GGanesh Rama Hegde·Feb 20Chapter 28 : UseCase25 - Hot vs Cold Flow comparisonIn this use case we will do an architectural level comparison of hot versus cold flow. CODE IMPLEMENTATION package org.kotlinflowlearner.stockflow.usecases.uc25 import kotlinx.coroutines.flow.* impor4 min read·kotlinflow.hashnode.dev
GGanesh Rama Hegde·Feb 19Chapter 26 : UseCase23 - SharedFlow (Hot Streams)Everything that we have seen until now was cold flows. Now we enter the world of "hot” flows. Cold flow means: Nothing runs until collected Each collector gets its own independent execution Flow re4 min read·kotlinflow.hashnode.dev
GGanesh Rama Hegde·Feb 19Chapter 25 : UseCase22 - Context Switching with flowOnIn this chapter we answer the core question : If Flow is sequential, then how do we control which thread executes which part? That’s what flowOn does. Flow is context-preserving by default. It means t2 min read·kotlinflow.hashnode.dev
GGanesh Rama Hegde·Feb 17Chapter 23 : UseCase20 - Buffering for PerformanceThere are real-world cases where producer is faster than consumer. By default, Flow is sequential. That means: Upstream emits Downstream processes Only then next value emits This is slow but safe. But differing speeds of producers and consumers ...2 min read·kotlinflow.hashnode.dev