flatMapInitial

inline fun <T : Any> Fetch<T>.flatMapInitial(transform: () -> Fetch<T>): Fetch<T>

Transform an initial fetch state to finished.

  • This is a convenience method for fold, that forces the output to be a Fetch.

  • Unlike mapFetchingToFinished, this function does not re-wrap as finished.

  • Because finished is not mapped, this function cannot update the type, T (i.e. the result of transform must be of the same type as the Fetch caller)!

Receiver

The Fetch to transform.

Return

The transformed Fetch of type T.

Parameters

T

The type of the Fetch value.

transform

The lambda to transform the initial state into a finished.