emit

inline suspend fun <T> FlowCollector<T>.emit(recover: FlowCollector<T>.(Throwable) -> T = { throw it }, block: FlowCollector<T>.() -> T)

Emit the result of block, with a built-in try-catch.

By default, recover rethrows!

Parameters

recover

The transformation to apply to all caught non-fatal throwables.

block

The block of code to execute.