5.5.3 Coroutines with Networking Calls
Coroutines with Networking Calls
// Dispatchers.Main
suspend fun functionA() {
val result = get("developer.android.com")
show(result)
}
suspend fun get(url: String) =
// Dispatchers.IO
withContext(Dispatchers.IO) { actualNetworkingCall() }
Last updated
Was this helpful?