kotlin async await vs lanch co-routine
Kotlin launch is a co-routine operating under the model 'fire-and-forget'. It returns a Job object that we can use to see if it is active or cancel it. It is also non-blocking. import kotlinx.coroutines.* fun main () = runBlocking { // Launch a background coroutine val job = launch { delay ( 1000L ) println ( " World! " ) } println ( " Hello, " ) // This prints immediately while 'World!' is waiting job . join () // (Optional) Wait for the launch block to finish } If you want to fetch user data from a network API and use that data, launch won't cut it because it can't return the data. You must use async , which is where await() comes into play: This is a good example of launch use-case class ProfileViewModel : ViewModel () { // viewModelScope automatically cancels the launch if ...