FieldSerialization

sealed interface FieldSerialization<V>

Describes how a StateField's value is serialized to/from JSON.

Use FieldSerialization.none (the default) when the field does not need serialization, or FieldSerialization.Custom to provide conversion functions.

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Custom<V>(val toJSON: (V, EditorState) -> Any?, val fromJSON: (Any?, EditorState) -> V) : FieldSerialization<V>

Custom serialization with explicit toJSON and fromJSON conversion functions.

Link copied to clipboard

The field is not serializable. This is the default.

Link copied to clipboard
data class Serializer<V>(val serializer: KSerializer<V>) : FieldSerialization<V>

Type-safe serialization using a kotlinx.serialization.KSerializer.