ParcelableSerializer



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

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.ParcelableSerializer

@Serializable
data class MyModel(
    @Serializable(with = ParcelableSerializer::class) val parcelable: android.os.Parcelable
)

Summary

Public constructors

android

Public functions

final T
deserialize(decoder: Decoder)
android
final Unit
serialize(encoder: Encoder, value: T)
android

Public properties

final SerialDescriptor
android

Public constructors

ParcelableSerializer

<T : Parcelable> ParcelableSerializer()

Public functions

deserialize

final fun deserialize(decoder: Decoder): T

serialize

final fun serialize(encoder: Encoder, value: T): Unit

Public properties

descriptor

final val descriptorSerialDescriptor