SavedStateSerializer


public final class SavedStateSerializer


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

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

import androidx.savedstate.serialization.serializers.SavedStateSerializer

@Serializable
data class MyModel(
    @Serializable(with = SavedStateSerializer::class) val savedState: SavedState
)

Summary

Public constructors

Public constructors

SavedStateSerializer

Added in 1.3.0-alpha06
public SavedStateSerializer()

Public methods

serialize

public void serialize(
    @NonNull <Error class: unknown class> encoder,
    @NonNull SavedState value
)