CharSequenceSerializer


public class CharSequenceSerializer<T extends CharSequence> implements KSerializer


A serializer for CharSequence. This serializer uses SavedState's API directly to save/load a CharSequence.

Note that this serializer should be used with SavedStateEncoder or SavedStateDecoder only. Using it with other Encoders/Decoders may throw IllegalArgumentException.

import androidx.savedstate.serialization.serializers.CharSequenceSerializer

@Serializable
data class MyModel(
    @Serializable(with = CharSequenceSerializer::class) val charSequence: CharSequence
)

Summary

Public constructors

Public methods

final @NonNull T
final @NonNull SerialDescriptor
final void
serialize(@NonNull Encoder encoder, @NonNull T value)

Public constructors

CharSequenceSerializer

public <T extends CharSequence> CharSequenceSerializer()

Public methods

deserialize

Added in 1.3.0-alpha06
public final @NonNulldeserialize(@NonNull Decoder decoder)

getDescriptor

Added in 1.3.0-alpha06
public final @NonNull SerialDescriptor getDescriptor()

serialize

Added in 1.3.0-alpha06
public final void serialize(@NonNull Encoder encoder, @NonNull T value)