DispatcherProvider

Coroutine dispatchers used internally by Stream libraries. Should always be used instead of directly using Dispatchers or creating new dispatchers.

Can be modified using set and reset for testing purposes.

Properties

Link copied to clipboard
val Immediate: CoroutineDispatcher

Represents the Immediate coroutine dispatcher, which is usually tied to the UI thread.

Link copied to clipboard
var IO: CoroutineDispatcher

Represents the IO coroutine dispatcher, which is usually tied to background work.

Link copied to clipboard
var Main: CoroutineDispatcher

Represents the Main coroutine dispatcher, tied to the UI thread.

Functions

Link copied to clipboard
fun reset()

Resets the dispatchers to their default values. For testing purposes only.

Link copied to clipboard
fun set(mainDispatcher: CoroutineDispatcher, ioDispatcher: CoroutineDispatcher)

Overrides the main (UI thread) and IO dispatcher. For testing purposes only.