runSuspended
suspend fun <T> runSuspended(dispatcher: CoroutineDispatcher = Dispatchers.IO, body: suspend CoroutineScope.() -> T): T
Run a block of code within a coroutine scope, defined by a given dispatcher.
This is intended for use with code that normally isn't designed to be run within a coroutine, such as database actions.
Parameters
dispatcher
The dispatcher to use - defaults to Dispatchers.IO.
body
The block of code to be run.