I want to create a Kotlin coroutines Flow
that emits values when
This seems to work -- every time a new value arrives, transformLatest
cancels any previous lambdas and starts a new one. So this approach emits, and then continues to emit periodically until a new value arrives.
flow.transformLatest { value ->
while(currentCoroutineContext().isActive) {
emit(value)
delay(x)
}
}