Mariano Zorrilla
03/11/2020, 2:41 PMMariano Zorrilla
03/11/2020, 2:42 PMAdam Powell
03/11/2020, 2:44 PMMariano Zorrilla
03/11/2020, 2:44 PMMariano Zorrilla
03/11/2020, 2:45 PMAdam Powell
03/11/2020, 2:45 PMAdam Powell
03/11/2020, 2:45 PMMariano Zorrilla
03/11/2020, 2:46 PMAdam Powell
03/11/2020, 2:47 PM@Model
which will notify compose if any of its vars change, but you're not changing one of its vars, you're changing a mutable list contained thereinAdam Powell
03/11/2020, 2:49 PM@Composable
from your emitter
- it doesn't need to be special, and you don't want to wrap the change in state {}
- that's for declaring a tracked MutableState<T>
and `remember {}`ing it at that point in the composition. You already have your state object and don't need to create another.Adam Powell
03/11/2020, 2:50 PMMariano Zorrilla
03/11/2020, 2:51 PMAdam Powell
03/11/2020, 2:53 PMmodelListOf
instead of mutableListOf
Adam Powell
03/11/2020, 2:54 PMval
rather than a var
Mariano Zorrilla
03/11/2020, 2:55 PMMariano Zorrilla
03/11/2020, 2:57 PMMariano Zorrilla
03/11/2020, 2:57 PMMariano Zorrilla
03/11/2020, 3:06 PMZach Klippenstein (he/him) [MOD]
03/11/2020, 6:13 PMwithIndex()
on your list before passing it to AdapterList
.Mariano Zorrilla
03/11/2020, 6:20 PMMariano Zorrilla
03/11/2020, 6:26 PMAdam Powell
03/11/2020, 7:41 PMAdam Powell
03/11/2020, 7:42 PMkotlinx.collections.immutable
library's PersistentList
and assign the new immutable lists to a model field or State<T>
- we use those collections internally in compose so it's not going to add any more overhead to your apk size than is already thereMariano Zorrilla
03/11/2020, 7:43 PMMariano Zorrilla
03/11/2020, 7:43 PMAdam Powell
03/11/2020, 7:45 PMRyan Mentley
03/13/2020, 8:24 AMRyan Mentley
03/13/2020, 8:24 AMRyan Mentley
04/08/2020, 12:11 PMMariano Zorrilla
04/10/2020, 2:36 PM