Hi :wave::skin-tone-3: How can I replace Rx operat...
# flow
j
Hi 👋🏼 How can I replace Rx operator
repeat
with some Flow operator?
e
Copy code
fun <T> Flow<T>.repeat(): Flow<T> = flow {
    while (true) emitAll(this@repeat)
}
j
I have to create my Flow operator, right? maybe like that:
Copy code
fun <T> Flow<T>.repeat(times: Int): Flow<T> = flow {
    repeat (times) { emitAll(this@repeat) }
}
I opened a PR with something like that https://github.com/Kotlin/kotlinx.coroutines/pull/2702
e
Copy code
public fun <T> Flow<T>.repeatUntil(condition: () -> Boolean): Flow<T>
should take a
suspend () -> Boolean
lambda, at least… maybe even
suspend FlowCollector<T>.() -> Boolean