Ayomide
01/09/2021, 8:24 PMmutableStateOf()
a mutable list of strings. I'm just using a forEach inside a column to display the items.
messageList.forEach {Text(it)}
However, I don't seem to see any updates on the screen when the list gets a new item (The list is updated via a coroutine scope fetching data from elsewhere). I put a println()
to debug, and the list definitely changes in size - so I think I must be doing something wrongTash
01/09/2021, 8:57 PMmutableStateOf
with a mutable list? You might have to use either one of these two instead:
var list with mutableStateOf(immutableList)
OR
val list with mutableStateListOf(initialData)
In the first case, you'd have to reassign list
since its immutable, but in the second case, you wouldn't have to do that because list
is mutable.Ayomide
01/09/2021, 11:04 PM