serializationSaver

@ExperimentalSerializationApi
inline fun <T> serializationSaver(serializer: KSerializer<T> = serializer(), bundler: Bundler = Bundler): Saver<T, Any>

Create an Saver for Kotlin Serialization.

Usage:

@Serializable
data class FormData(
val firstName: String = "",
val lastName: String = "",
val email: String = "",
val mobileNumber: String = "",
val title: Title? = null,
val developer: Boolean? = null
)

enum class Title {
Mr,
Mrs,
Miss,
Dr,
}

Form(
onSubmit = { .. },
initialValue = FormData(),
modifier = modifier,
saver = serializationSaver()
) { .. }

Return

The Saver for the value.

Parameters

T

The type of the value to save and restore.

serializer

The serializer to use for the value.

bundler

The bundler to encode and decode the value. Default is Bundler.