voben
05/13/2020, 3:19 AMdoSomethingElse() get called before the network call completes? How could I improve this?
suspend fun signOut() {
coroutineScope {
launch {
makeNetworkRequest() // suspending function
}
}
doSomethingElse()
}octylFractal
05/13/2020, 3:24 AMcoroutineScope will suspend until the launch is finishedoctylFractal
05/13/2020, 3:26 AMCoroutineScope to start it on, or as a last resort you can use GlobalScopeoctylFractal
05/13/2020, 3:26 AMdoSomethingElse(), but still wait for it to complete before signOut() finishes, then move doSomethingElse() inside the coroutineScope blockgregd
05/13/2020, 2:26 PMgregd
05/13/2020, 2:27 PMgregd
05/13/2020, 2:28 PMgregd
05/13/2020, 2:29 PMvoben
05/13/2020, 2:33 PMgregd
05/13/2020, 2:38 PM