https://kotlinlang.org logo
#compose
Title
# compose
k

Kshitij Patil

12/02/2020, 4:39 PM
How to use flow with lazyColumn?
collectAsState()
or adding each element in a local
MutableSnapshotList
using something like
onEach
or
collect { }
I guess you'd use
Flow<List<T>>
in the dao instead of
Flow<T>
to get all the items
g

Giorgos Neokleous

12/02/2020, 6:23 PM
collectAsState
feels more idiomatic. Adding to the snapshot list feels like trying to fit imperative habits into it 🤷‍♂️ That's my opinion though
k

Kshitij Patil

12/02/2020, 9:03 PM
Yes. I was looking for a list being updated in real-time and with Room's support for
Flow<List<T>>
and compose's
collectAsState
I was easily able to achieve the same
16 Views