Karol Kulbaka
12/19/2023, 7:32 PM(P)->R
and I want to use flow api to handle it.
I can't create flow standard way through flow builder because parameter P is not known at this point.
Is there a way to achieve result similar to this:
fun Flow<R>.asLambda(operation: (P)->R): (P)->Unit = {
// some magic that allow me to use P parameter to modify existing flow emission
collect()
}
Shawn
12/19/2023, 7:56 PMfun <P, R> Flow<R>.asLambda(operation: (P) -> R): (P) -> Unit = {
operation(it)
...
}
Daniel Pitts
12/20/2023, 12:56 AMfun makeFlow(parameter: P) = flow {
val r = operator(P)
Karol Kulbaka
12/20/2023, 2:34 PMDaniel Pitts
12/20/2023, 6:13 PMKarol Kulbaka
12/21/2023, 7:53 PMDaniel Pitts
12/21/2023, 10:42 PM