rook
08/08/2019, 9:44 PMsuspend
function execute its contents on a specific dispatcher. So far:```
suspend fun getFoo(): Foo? = coroutineScope {
withContext(Dispatchers.IO) { retrieveFoo() }
}```
Is this the best way to go about it?octylFractal
08/08/2019, 9:46 PMcoroutineScope
, just doing withContext
should workrook
08/08/2019, 9:47 PMgildor
08/09/2019, 2:51 AM<http://Dispatchers.IO|Dispatchers.IO> { retrieve Foo }
There is invoke operator for DispatcheroctylFractal
08/09/2019, 2:52 AMEric Martori
08/09/2019, 12:56 PMgildor
08/09/2019, 12:59 PMEric Martori
08/09/2019, 1:04 PMinvoke
operator for CoroutineDispatcher
in what version is this available? Or is it not part of the core?gildor
08/09/2019, 1:05 PMEric Martori
08/09/2019, 1:07 PM