Package-level declarations

Types

Link copied to clipboard
data class ErrorWithCache<out Ok : Any, out Error : Any>(val error: Error, val cache: Ok? = null)
Link copied to clipboard
sealed interface Fetch<out T : Any>

A wrapper for asynchronous fetch operations.

Link copied to clipboard
class SafeFetchFlow<T : Any> : AbstractFlow<Fetch<T>> , Flow<Fetch<T>>

AbstractFlow implementation for FetchFlow.

Functions

Link copied to clipboard
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.

Link copied to clipboard
fun <T : Any> fetch(timeout: Duration = Duration.INFINITE, recover: FetchCollector<T>.(Throwable) -> Fetch<T> = { throw it }, block: suspend FetchCollector<T>.() -> T): FetchFlow<T>

Create a new FetchFlow with the given block of code to execute.

Link copied to clipboard
inline suspend fun FetchCollector<Nothing>.fetching()

Send a fetch in progress status to the current flow-scope.

Link copied to clipboard
inline suspend fun <T : Any> FetchCollector<T>.finished(result: T)

Send a fetch finished status to the current flow-scope, with the encapsulated result.

Link copied to clipboard
inline suspend fun FetchCollector<Nothing>.reset()

Send a fetch not started status to the current flow-scope.