Dispatchers.IO runs coroutines that call blocking input/output APIs on an automatically scaling thread pool. Use it when the operation would otherwise occupy a thread while waiting. section 14.7.1 section 14.9
Switch to the I/O dispatcher
suspend fun loadData(): Data = withContext(Dispatchers.IO) { blockingApiCall() } `withContext` moves this blocking operation to Dispatchers.IO while keeping the surrounding code sequential. Choose Dispatchers.Default for general-purpose work unless blocking APIs or another special requirement calls for a different dispatcher. section 14.7.1 section 14.9
Table 14.2 Dispatchers available out of the box in Kotlin coroutines (view table figure)
Compare Dispatchers.IO with Default, Main, Unconfined, and limitedParallelism by thread count and intended use. section 14.7.1
