I am finding myself doing roughly: ```combine(one,...
# coroutines
I am finding myself doing roughly:
Copy code
combine(one, two, three) { 1, 2, 3 -> Triple(1,2,3) }.flatMapLatest { (1, 2, 3) -> ... }
is there a cleaner way built in to deal with that?
@tseisel It doesn't cancel running transform on new value like flatMapLatest does.
good catch Louis! I am going to go poke at it a bit, probably just a matter of holding a job ref in the containing object. even if a custom operator for a bit I can live with it
was going to do some custom impl but decided to just keep it simple for fear of buggy mess.
Copy code
inline fun <T1, T2, T3, R> combineFlatLatest(
    one: Flow<T1>,
    two: Flow<T2>,
    three: Flow<T3>,
    crossinline combiner: (T1, T2, T3) -> Flow<R>
): Flow<R> {
    return combine(one, two, three) { _one, _two, _three ->
        arrayOf(_one, _two, _three)
    }.flatMapLatest { elements ->
            elements[0] as T1, 
            elements[1] as T2, 
            elements[2] as T3