observe list in jetpack compose
val list = remember { mutableStateListOf() }
LazyColumn() {
itemsIndexed(list) { index, listItem ->
...
}
}
if using ViewModel:
In ViewModel file:
val listInViewModel = mutableStateListOf()
in Composable:
val list = remember { viewModel.listInViewModel }
LazyColumn() {
itemsIndexed(list) { index, listItem ->
...
}
}