ListSaverSample
@Composable
fun ListSaverSample() {
data class Size(val x: Int, val y: Int)
val sizeSaver =
listSaver<Size, Int>(save = { listOf(it.x, it.y) }, restore = { Size(it[0], it[1]) })
}The Saver implementation which allows to represent your Original class as a list of Saveable values.
Compose Multiplatform
Ship iOS, desktop, and web apps with Compose
RevenueCat
Add subscriptions to your apps in minutes
@Composable
fun ListSaverSample() {
data class Size(val x: Int, val y: Int)
val sizeSaver =
listSaver<Size, Int>(save = { listOf(it.x, it.y) }, restore = { Size(it[0], it[1]) })
}Last updated: