asPublisher

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

Transforms the given flow into a reactive specification compliant Flow Publisher.

An optional context can be specified to control the execution context of calls to the Flow 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.