withLatestFrom

fun <A, B, R> Flow<A>.withLatestFrom(other: Flow<B>, transform: suspend (A, B) -> R): Flow<R>(source)

Merges two Flows into one Flow by combining each value from self with the latest value from the second Flow, if any. Values emitted by self before the second Flow has emitted any values will be omitted.

Parameters

other

Second Flow

transform

A transform function to apply to each value from self combined with the latest value from the second Flow, if any.


inline fun <A, B> Flow<A>.withLatestFrom(other: Flow<B>): Flow<Pair<A, B>>(source)