ReflectiveSerializableCircuitSaver

fun ReflectiveSerializableCircuitSaver(configuration: SavedStateConfiguration = SavedStateConfiguration.DEFAULT, onRestoreError: (Throwable) -> Unit = {}): CircuitSaver(source)

Returns a CircuitSaver that persists @Serializable Screens and PopResults with kotlinx-serialization, resolving serializers reflectively from the saved class name.

In 0.35, Android screens and results must still be Parcelable, even though this saver stores serialized SavedState. That Android supertype requirement will be removed in a future release.

Unlike SerializableCircuitSaver, this requires no polymorphic registration in configuration's serializersModule. It relies on JVM reflection (Class.forName), so it is only available on JVM and Android.

R8/ProGuard

This artifact embeds the keep rules that reflective lookup needs, so minified Android apps work without additional configuration. The embedded rules keep the names of all CircuitSaveable implementations and their generated serializers.

Because restore matches on class names, renaming or moving a screen class invalidates its previously saved records. Restoring a class that no longer resolves, such as after an app update removed a screen, drops that record instead of failing. Pass onRestoreError to observe dropped records, such as for logging.