https://kotlinlang.org logo
#coroutines
Title
# coroutines
a

Adam Wilder

01/28/2023, 4:25 AM
I have a question regarding
FlowSubscription
from
ReactiveFlow
in kotlinx-coroutines-reactive. For a publisher of exactly 1 item, the behavior seems to be, on
request(1)
, the subscription will suspend until another is requested, and never completes. From a logical perspective that seems like it makes sense because how else do you know it’s complete unless you try and request one more. I just want to make sure, Is this intended behavior?
Untitled.kt
In the above example, it prints
Copy code
string1
done
string2
simply from going to flow and back, it never completes. This doesn’t seem quite right
2 Views