https://kotlinlang.org logo
#flow
Title
# flow
s

Sam Stone

10/12/2022, 2:17 AM
How do you collect a flow once in a non-blocking way, so it doesn't update when the flow updates?
m

Michael Marshall

10/12/2022, 6:11 AM
Are you looking for the suspend function
first()
?
n

Nick Allen

10/13/2022, 6:56 AM
Or maybe `StateFlow`/`stateIn` where you can just get the latest value?
s

Sam Stone

10/19/2022, 4:35 AM
I think
toCollection()
accomplishes what I want?
n

Nick Allen

10/20/2022, 2:25 AM
Yeah if you want all the items at once when the Flow finishes
3 Views