toFlow

fun <T> ApiResponse<T>.toFlow(): Flow<T>

Author

skydoves (Jaewoong Eum)

Returns a Flow which emits successful data if the response is a ApiResponse.Success and the data is not null.

Return

A coroutines Flow which emits successful data.


inline fun <T, R> ApiResponse<T>.toFlow(crossinline transformer: T.() -> R): Flow<R>

Author

skydoves (Jaewoong Eum)

Returns a Flow which contains transformed data using successful data if the response is a ApiResponse.Success and the data is not null.

Return

A coroutines Flow which emits successful data.

Parameters

transformer

A transformer lambda receives successful data and returns anything.