takeItem

fun <T> ReceiveChannel<T>.takeItem(name: String? = null): T

Assert that the next event received was an item and return it. This function will not suspend. On JVM and Android, it will attempt to throw if invoked in a suspending context.

Throws

if the next event was completion or an error, or no event.