I am learning co-routines
I have a sample from developer docs
suspend fun fetchDocs() { // Dispatchers.Main
val result = get("https://developer.android.com") // Dispatchers.IO for `get`
show(result) // Dispatchers.Main
}
suspend fun get(url: String) = withContext(Dispatchers.IO) { /* ... */ }
In the example above, get() still runs on the main thread, but it suspends the coroutine before it starts the network request. When the network request completes, get resumes the suspended coroutine instead of using a callback to notify the main thread.
What I understand: Co routines suspend the long running operations from main thread and once the long running operations complete ... they resume instead of giving a callback and without blocking the main thread
Question: What happens when in screen one, I suspend the code and before it resumes I navigate the screen two.