fetch Unwrap
inline fun <T> FetchFlow<T & Any>.fetchUnwrap(crossinline recover: suspend (Fetch<T & Any>) -> T = { error("Fetch has not finished!") }): Flow<T>
Attempt to unwrap a FetchFlow to produce a Flow of it's result.
val fetch: Fetch<String> = Fetch.Initial
fetch.unwrap() // getOrThrow() (default behaviour)
fetch.unwrap { null } // getOrNull() (initial & fetching to null)
fetch.unwrap { "$it" } // getOrElse() (initial & fetching to string)
Content copied to clipboard
Return
See also
FetchFlow. fetch Or Throw
FetchFlow. fetch Or Null
FetchFlow. fetch Or Else
FetchFlow. fetch Or Default
Throws
if default recover value is used and fetch is initial or in progress.