Is there a safe way to use `combine()` when you ha...
# coroutines
m
Is there a safe way to use
combine()
when you have a long list of Flows? I worry about the Flows and the param names becoming unsynced as the code is changed over time.
Copy code
combine(
      stringFlow1,
      stringFlow2,
      intFlow1,
      intFlow2,
    ) { string2, string1, int2, int1 ->
     
    }
a
You can make lambda parameter types explicit:
Copy code
combine(colors, sizes) { color: Color, size: Size -> ... }
👍 1
l
I think he meant if the types are the same, so if you change the order of the parameters, the compiler would error afaik there's no way. What we do is whenever possible, create intermediate flows combining just a few
👍 1
n
You can also use inline (value) classes to wrap your primitive types and avoid type mismatch https://kotlinlang.org/docs/inline-classes.html