Main

A coroutine dispatcher that is confined to the Main thread operating with UI objects. Usually such dispatcher is single-threaded.

Access to this property may throw IllegalStateException if no main dispatchers are present in the classpath.

Depending on platform and classpath it can be mapped to different dispatchers:

In order to work with Main dispatcher, following artifact should be added to project runtime dependencies:

Implementation note: MainCoroutineDispatcher.immediate is not supported on Native and JS platforms.