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.

Parameters

recover

The transformation to apply to any non-fatal Throwable that is caught.

block

The block of code to execute.