combineTransform

@JvmName(name = "flowCombineTransform")
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)
}

fun <T1, T2, R> combineTransform(flow: Flow<T1>, flow2: 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()
combineTransform(flow, flow2) { request, searchEngine ->
    emit("Downloading in progress")
    val result = download(request, searchEngine)
    emit(result)
}

fun <T1, T2, T3, R> combineTransform(    flow: Flow<T1>,     flow2: Flow<T2>,     flow3: Flow<T3>,     transform: suspend FlowCollector<R>.(T1, T2, T3) -> Unit): Flow<R>(source)
fun <T1, T2, T3, T4, R> combineTransform(    flow: Flow<T1>,     flow2: Flow<T2>,     flow3: Flow<T3>,     flow4: Flow<T4>,     transform: suspend FlowCollector<R>.(T1, T2, T3, T4) -> Unit): Flow<R>(source)
fun <T1, T2, T3, T4, T5, R> combineTransform(    flow: Flow<T1>,     flow2: Flow<T2>,     flow3: Flow<T3>,     flow4: Flow<T4>,     flow5: Flow<T5>,     transform: suspend FlowCollector<R>.(T1, T2, T3, T4, T5) -> Unit): Flow<R>(source)
inline fun <T, R> combineTransform(vararg flows: Flow<T>, crossinline transform: suspend FlowCollector<R>.(Array<T>) -> Unit): Flow<R>(source)
inline fun <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.