ProducerScope

Scope for the produce, callbackFlow and channelFlow builders.

Properties

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.

Functions

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.