Dispatchers Across Platforms
Choose dispatchers that exist on Android and iOS.
Where Work Actually Runs
A coroutine still runs on some thread. A dispatcher decides which thread or pool it uses, and that choice matters on each platform.
Meet Dispatchers.Default
Use Dispatchers.Default for CPU-heavy work like parsing or sorting. It exists on Android and iOS, so shared code can rely on it.
withContext(Dispatchers.Default) { sort(data) }All lessons in this course
- suspend Functions That Work Everywhere
- Dispatchers Across Platforms
- CoroutineScope & Lifecycle
- withContext & Structured Concurrency