Slava
Slava

Reputation: 717

MutableStateOf of mutableList not updating

Why my mutableStateOf of mutableList not updating?

    val checkedList by remember {
        mutableStateOf(MutableList(list.size) { false })

Upvotes: 1

Views: 588

Answers (1)

Goutham Reddy
Goutham Reddy

Reputation: 11

I would suggest you to use val checkedList by remember { mutableStateListOf<Boolean> { false }). This helps you better with update operations with view model flows and better code readability Source with example : https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#mutableStateListOf()

Upvotes: 1

Related Questions