All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ua.railian.data.result.flow.flow-extensions.kt Maven / Gradle / Ivy

Go to download

DataResult is a discriminated union that encapsulates a successful outcome with a value of type [T] or a failure with an error of type [E].

There is a newer version: 0.3.0-alpha06
Show newest version
package ua.railian.data.result.flow

import kotlinx.coroutines.flow.Flow

//region Kotlin combine extensions
/**
 * Returns a [Flow] whose values are generated with [transform] function by combining
 * the most recently emitted values by each flow.
 */
@Suppress("UNCHECKED_CAST")
public fun  combine(
    flow: Flow,
    flow2: Flow,
    flow3: Flow,
    flow4: Flow,
    flow5: Flow,
    flow6: Flow,
    transform: suspend (T1, T2, T3, T4, T5, T6) -> R
): Flow = kotlinx.coroutines.flow.combine(
    flow, flow2, flow3, flow4, flow5, flow6,
) { args: Array<*> ->
    transform(
        args[0] as T1,
        args[1] as T2,
        args[2] as T3,
        args[3] as T4,
        args[4] as T5,
        args[5] as T6,
    )
}
//endregion




© 2015 - 2024 Weber Informatics LLC | Privacy Policy