interface ProducerScope<in E> : CoroutineScope, SendChannel<E>

Scope for the produce, callbackFlow and channelFlow builders.


Link copied to clipboard
abstract val channel: SendChannel<E>

A reference to the channel this coroutine sends elements to. It is provided for convenience, so that the code in the coroutine can refer to the channel as channel as opposed to this. All the SendChannel functions on this interface delegate to the channel instance returned by this property.


Link copied to clipboard
suspend fun ProducerScope<*>.awaitClose(block: () -> Unit = {})

Suspends the current coroutine until the channel is either closed or cancelled and invokes the given block before resuming the coroutine.


Link copied to clipboard