next

abstract suspend fun next(): E

Awaits for the next item from the channel.

Return

The next item from the channel.


open suspend fun next(timeout: Duration): E?

Awaits for the next item from the channel, or null if the timeout is reached.

Return

The next item from the channel, or null.


abstract suspend fun next(n: Int): List<E>

Awaits for the next N items from the channel. This method will suspend indefinitely until N items are received.

Return

A list of the next N items from the channel.

Parameters

n

The number of items to receive from the channel.


abstract suspend fun next(n: Int, timeout: Duration): List<E>

Awaits for the next N items from the channel, or until the timeout is reached. Once the timeout is reached, the list of received items is returned, even if fewer than N items have been received.

Return

A list of the received items.

Parameters

n

The number of items to receive from the channel.

timeout

The maximum time to wait for items.