Hi, what is the canonical way to create a flow tha...
# coroutines
r
Hi, what is the canonical way to create a flow that replays its history whenever it's subscribed to? I have a Flow<String> that contains some log lines and whenever someone calls my API I'd like it to publish all previous log lines and additionally any new ones, by returning the flow as a server-sent event
o
a flow can't replay its history, but every time you run a terminal operation it will rerun the original flow. you'd have to make that source replay all data somehow
r
Yes, I saw those issues, but I thought I was just fundamentally misunderstanding the issue. It's fine if I need to keep the original data around somewhere, but I was wondering how to connect the 'previously sent data' to the newly available data. More specifically, how to join the old data with the new data coming from a
callbackFlow
but I guess that's just doing a
concat
on them