Closed Diy2210 closed 4 years ago
just change arrayOf
to listOf
and use List instead of Array.
or do viewModel.diskInfoArray.map { it.toList() }
to convert Array into List
I try convert Array to List, but my MutableLiveData type Model and ListWidget work only with TableUnitItem. I need convert MutableLiveData to TableUnitItem?
oh, yes. you should map your model into TableUnitItem. For example you can use standard unit items - https://github.com/icerockdev/moko-units/blob/master/units-basic/src/commonMain/kotlin/dev/icerock/moko/units/basic/table/BasicTableUnitItem.kt or you can create WidgetTableUnitItem just like here - https://github.com/icerockdev/moko-widgets/blob/master/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/units/UserUnitWidget.kt#L94
Thanks, I got it. All works!
Hi, I try add items to ListWidget, type arrayOf. How can I do this?
My Array:
My Live Data:
My ListWidget: