CLOVIS
07/29/2024, 12:06 PM<http://Dispatchers.IO|Dispatchers.IO> {
println("Foo")
}
which is the same as
withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
println("Foo")
}
Any idea why there are multiple ways to do it, and which one is preferred?Sam
07/29/2024, 12:13 PMSam
07/29/2024, 12:14 PMwithContext
CLOVIS
07/29/2024, 12:19 PMjw
07/29/2024, 1:15 PMTgo1014
07/29/2024, 1:38 PMjw
07/29/2024, 1:39 PMCLOVIS
07/29/2024, 1:39 PMkotlinx.coroutines.import
if you want to try it out.
(or, spell it out entirely:)
Dispatchers.IO.invoke {
…
}
Tgo1014
07/29/2024, 1:42 PMjw
07/29/2024, 2:45 PM