What causes the IDE to recommend using `withContex...
# coroutines
r
What causes the IDE to recommend using
withContext(Dispatchers.Default)
over
async
? Is
withContext
more optimal, somehow?
s
Using
async { }.await()
. Having the two function calls is unnecessary if you aren’t storing the Deferred and having it awaited elsewhere
r
I didn’t even realize that it had removed the need for the
await()
call, thanks!
👍🏿 1
l
Also, `async`+`await` will cancel the parent scope if a crash occurs, which may not be the behavior you want if you use it like
withContext
.
r
Good to know, thank you.
g
What is you use case? You just switch dispatcher?