Package-level declarations

Functions

Link copied to clipboard
suspend fun <T> Flow<T>.collectSafe(collector: FlowCollector<T>)
suspend fun <T> StateFlow<T>.collectSafe(collector: FlowCollector<T>)

suspend fun <T> Flow<T>.collectSafe(catchTimeout: Boolean, collector: FlowCollector<T>)

Collect Flow without throwing an exception, except CancellationException to cancel parent jobs. Tries to emit a single value if Flow.collect can not be called.

suspend fun <T> StateFlow<T>.collectSafe(catchTimeout: Boolean, collector: FlowCollector<T>)

Collect StateFlow without throwing an exception, except CancellationException to cancel parent jobs. Tries to emit a single value if StateFlow.collect can not be called.

Link copied to clipboard
fun <T> scopeCatching(catchTimeout: Boolean = false, block: () -> T): Result<T>

Equivalent of runCatching but able to throw CancellationException to cancel parent jobs.

Link copied to clipboard
suspend fun <T> suspendCatching(catchTimeout: Boolean = false, block: suspend CoroutineScope.() -> T): Result<T>

Equivalent of a suspendable runCatching but able to throw CancellationException to cancel parent jobs.

Link copied to clipboard
suspend fun <T> suspendSafeCast(block: suspend CoroutineScope.() -> T?): T?

Equivalent of a suspendable safeCast, able to throw CancellationException to cancel parent jobs.