combineTransform

@JvmName("flowCombineTransform") @ExperimentalCoroutinesApi fun <T1, T2, R> Flow<T1>.combineTransform(
    flow: Flow<T2>,
    transform: suspend FlowCollector<R>.(a: T1, b: T2) -> Unit
): Flow<R>
(source)

Returns a Flow whose values are generated by transform function that process the most recently emitted values by each flow.

The receiver of the transform is FlowCollector and thus transform is a generic function that may transform emitted element, skip it or emit it multiple times.

Its usage can be demonstrated with the following example:

val flow = requestFlow()
val flow2 = searchEngineFlow()
flow.combineTransform(flow2) { request, searchEngine ->
    emit("Downloading in progress")
    val result = download(request, searchEngine)
    emit(result)
}
@ExperimentalCoroutinesApi inline fun <T1, T2, T3, R> combineTransform(
    flow: Flow<T1>,
    flow2: Flow<T2>,
    flow3: Flow<T3>,
    crossinline transform: suspend FlowCollector<R>.(T1, T2, T3) -> Unit
): Flow<R>
(source)
@ExperimentalCoroutinesApi inline fun <T1, T2, T3, T4, R> combineTransform(
    flow: Flow<T1>,
    flow2: Flow<T2>,
    flow3: Flow<T3>,
    flow4: Flow<T4>,
    crossinline transform: suspend FlowCollector<R>.(T1, T2, T3, T4) -> Unit
): Flow<R>
(source)
@ExperimentalCoroutinesApi inline fun <T1, T2, T3, T4, T5, R> combineTransform(
    flow: Flow<T1>,
    flow2: Flow<T2>,
    flow3: Flow<T3>,
    flow4: Flow<T4>,
    flow5: Flow<T5>,
    crossinline transform: suspend FlowCollector<R>.(T1, T2, T3, T4, T5) -> Unit
): Flow<R>
(source)
@ExperimentalCoroutinesApi inline fun <reified T, R> combineTransform(
    vararg flows: Flow<T>,
    crossinline transform: suspend FlowCollector<R>.(Array<T>) -> Unit
): Flow<R>
(source)
@ExperimentalCoroutinesApi inline fun <reified T, R> combineTransform(
    flows: Iterable<Flow<T>>,
    crossinline transform: suspend FlowCollector<R>.(Array<T>) -> Unit
): Flow<R>
(source)

Returns a Flow whose values are generated by transform function that process the most recently emitted values by each flow.

The receiver of the transform is FlowCollector and thus transform is a generic function that may transform emitted element, skip it or emit it multiple times.