I have noticed the zip operator executes the corou...
# coroutines
I have noticed the zip operator executes the coroutines sequentially, see the following example:
Copy code
flowOf(getWeather(loc)).zip(flowOf(reverseGeocode(loc))) { weather, address ->
            weather to address
            .collect { println(it) }
The time it takes to execute this is the total time of the getWeather and reverseGeocode calls combined. I know I can use a map operator and two async/wait blocks to execute the two calls asynchronously. Is it possible to execute multiple coroutines like this with flow operators? I tried a couple of different things but without success? I saw https://github.com/Kotlin/kotlinx.coroutines/issues/1147 so perhaps all operators are sequential for now.
I think you're going for:
Copy code
flow {
}.zip(flow {
you need to put each call inside the flows, not directly in the arguments, otherwise it's just as if you called them in sequence (just like without
­čĹŹ­čĆ╗ 1
Yes, that is it! It works now. Thanks.
flowOf is sequential! It won't proceed down the pipeline until the code returns with the value after suspension point i guess