What are some common patterns for managing which D...
# codereview
d
What are some common patterns for managing which Dispatcher should be used? So far I am using something like this:
Copy code
interface WorkerScope : CoroutineScope
An implementation might look like this:
Copy code
private val workerScope: WorkerScope = object : WorkerScope {
        override val coroutineContext: CoroutineContext =
            Dispatchers.Default
    }
For testing I do this:
Copy code
internal object CoroutineTestingScope : CoroutineScope, WorkerScope, IOScope, MainScope {
    override val coroutineContext: CoroutineContext =
        Dispatchers.Unconfined
}