fold

inline fun <Data : Any, Output> FetchFlow<Data>.fold(crossinline prefetch: suspend Prefetch.() -> Output, crossinline fetching: suspend Fetching<Data>.() -> Output, crossinline finished: suspend Finished<Data>.() -> Output): Flow<Output>

Fold a FetchFlow into a Flow of Output.

Fold can be used to map or flatMap all Fetch variants, but it also can output any type.

Receiver

The FetchFlow to fold.

Return

A Flow of the folded value, as type Output.

Parameters

Data

The type of the Fetch value.

Output

The type of the folded value.

prefetch

The lambda to transform the Prefetch.

fetching

The lambda to transform the Fetching.

finished

The lambda to transform the Finished.