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

Access to this property may throw an 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 the Main dispatcher, the following artifact should be added to the project runtime dependencies:

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