asPublisher

fun <T : Any> Flow<T>.asPublisher(context: CoroutineContext = EmptyCoroutineContext): Publisher<T>(source)

Transforms the given flow into a reactive specification compliant Publisher.

This function is integrated with ReactorContext from kotlinx-coroutines-reactor module, see its documentation for additional details.

An optional context can be specified to control the execution context of calls to the Subscriber methods. A CoroutineDispatcher can be set to confine them to a specific thread; various ThreadContextElement can be set to inject additional context into the caller thread. By default, the Unconfined dispatcher is used, so calls are performed from an arbitrary thread.