How's the cleanest way to update the state of each item in a
LazyColumn
when using paging 3? 1) In the viewModel using
map { it.map { ... } }
on the pager's flow, or 2) in the
items(...) { }
block calling some kind of state machine or flow that comes with the item in the list (also injected in the Pager's
map { }
of the flow) and collecting it there to make the changes, or 3) something else?
i
Ian Lake
07/03/2023, 5:28 PM
Paging is based on a single source of truth (such as your database), so usually you'd want to change that. What kind of changes are you doing?
d
dave08
07/03/2023, 6:48 PM
A broadcast receiver and a progress flow that I get from a WorkManager task. Also pressing a button in the details view might also cause a state change in the list view too
dave08
07/03/2023, 6:50 PM
The paging is coming in from the network.
dave08
07/05/2023, 1:27 PM
@Ian Lake do you have any suggestions for this? I tried looking all over for the sanest way to do this, I'm starting to think that I'd just need to implement my own pagination for this... but I'd rather avoid that.