Type 'State?>' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate

前端 未结 4 1269
我寻月下人不归
我寻月下人不归 2021-02-13 02:53

I\'m trying to get a value from LiveData with observeAsState in jetpack compose, but I get a weird error

Type \'State\' has no method \'getValue

4条回答
  •  被撕碎了的回忆
    2021-02-13 03:27

    I think type of items must be nullable since you observing LiveData:

    val items: List? by userViewModel.fetchUserList.observeAsState()
    

提交回复
热议问题