Mistakes you make using Kotlin Coroutines
summary
Lists the concrete pitfalls and fixes: using async with immediate await (no parallelism), wrapping work in a child launch inside coroutineScope (redundant), starting background work on the wrong scope instead of application or ViewModel scope, and misusing GlobalScope. Warns against runBlocking in suspending contexts, shows cancellation traps (Job vs SupervisorJob, supervisorScope vs context+supervisorJob), missing cancellation points—use yield/ensureActive—and forgotten cleanup requires withContext(NonCancellable). Recommends Dispatchers.IO for blocking I/O and Blockhound integration to detect blocking calls.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 1:51Coroutine builder mistakes
- 7:37Cancellation problems
- 18:39Cancellation exceptions
- 20:30Android coroutine pitfalls
- 23:20Dispatcher misuse
- 26:55Suspend/flow anti-patterns
- 28:43Code review contest








