Answers for "observe list in jetpack compose"

0

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 ->
    	...
    }
}
Posted by: Guest on July-27-2021

Code answers related to "observe list in jetpack compose"

Browse Popular Code Answers by Language