FlowTurbine

interface FlowTurbine<T>

Represents active collection on a source Flow which buffers item emissions, completion, and/or errors as events for consuming.

Functions

awaitComplete
Link copied to clipboard
abstract suspend fun awaitComplete()
Assert that the next event received was the flow completing.
awaitError
Link copied to clipboard
abstract suspend fun awaitError(): Throwable
Assert that the next event received was an error terminating the flow.
awaitEvent
Link copied to clipboard
abstract suspend fun awaitEvent(): Event<T>
Assert that an event was received and return it.
awaitItem
Link copied to clipboard
abstract suspend fun awaitItem(): T
Assert that the next event received was an item and return it.
cancel
Link copied to clipboard
abstract fun cancel()
Cancel collecting events from the source Flow.
cancelAndConsumeRemainingEvents
Link copied to clipboard
abstract fun cancelAndConsumeRemainingEvents(): List<Event<T>>
Cancel collecting events from the source Flow.
cancelAndIgnoreRemainingEvents
Link copied to clipboard
abstract fun cancelAndIgnoreRemainingEvents(): Nothing
Cancel collecting events from the source Flow and ignore any events which have already been received.
expectComplete
Link copied to clipboard
open suspend fun expectComplete()
expectError
Link copied to clipboard
open suspend fun expectError(): Throwable
expectEvent
Link copied to clipboard
open suspend fun expectEvent(): Event<T>
expectItem
Link copied to clipboard
open suspend fun expectItem(): T
expectMostRecentItem
Link copied to clipboard
abstract fun expectMostRecentItem(): T
Returns the most recent item that has already been received.
expectNoEvents
Link copied to clipboard
abstract fun expectNoEvents()
Assert that there are no unconsumed events which have already been received.

Properties

timeout
Link copied to clipboard
abstract val timeout: Duration
Duration that awaitItem, awaitComplete, awaitError, and awaitEvent will wait before throwing a timeout exception.