-
Notifications
You must be signed in to change notification settings - Fork 1.9k
combineLatest(Iterable<Flow>) operator #1262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What do you expect this method to return, |
For consistency with the other overloads of this operator, it should probably take a function parameter that accepts the combined array or list and returns an arbitrary type. This is also how RxJava's |
I agree with @zach-klippenstein, it should take a function parameter instead. Something like this would be better: fun <T, R> combineLatest(
flows: Iterable<Flow<T>>,
transform: suspend (Array<T>) -> R
): Flow<R> |
I see no real reasons not to do it. I let this issue to stay for a while (to see if there are people interested in it) and fix it. |
I find For example if we take this one: kotlinx.coroutines/kotlinx-coroutines-core/common/src/flow/operators/Zip.kt Lines 120 to 134 in f77533c
This makes no sense for me. It's not that I want to combine source |
Just to add on, I find the first example below easier to read than the second. combineLatest(
flow1,
flow2,
flow3
) { .. } flow1.combineLatest(
flow2,
flow3
) { .. }
|
Please add a
combineLatest
operator which accepts a list of Flows. Here is an example of my use case:The text was updated successfully, but these errors were encountered: