I didn't understand how kotlin coroutines work. I need to do a long work on an asynchronous thread and get the result on the UI Thread in an Android app. Can someone give me some examples? For example
private fun getCountries(){
viewModelScope.launch {
val a = model.getAllCountries()
countriesList.value = a
}
}
will lunch model.getAllCountries() async but in the end how can i get result to UI Thread?