turbine / app.cash.turbine / FlowTurbine / expectItem

expectItem

abstract suspend fun expectItem(): T

Assert that the next event received was an item and return it. If no events have been received, this function will suspend for up to timeout.

Exceptions

AssertionError - if the next event was completion or an error.

TimeoutCancellationException - if no event was received in time.