From Parcelable to @Serializable
summary
Shows how SavedState uses KotlinX Serialization to replace Parcelable boilerplate by annotating data classes with @Serializable and using top-level helpers like encodeToSavedState/decodeFromSavedState plus delegates for SaveStateRegistryOwner and SaveStateHandle and a Compose helper rememberSerializable. Demonstrates serialized SafeState layout (root empty-string key, nested maps and indexed lists), warns about bigger payloads hitting Android's 1 MB Bundle limit, potential runtime crashes with polymorphism/contextual serializers, and that the on-disk representation is not stable across releases.
AI-written summary · about
chapters (16)
- 0:00State retention on Android
- 1:31Config changes vs process death
- 2:55Current state retention solutions
- 4:40Prefer Safe State over APIs
- 5:43Introducing Kotlinx serialization
- 7:29Parcelable’s boilerplate limits
- 8:12Simplify serialization with @Serializable
- 9:41Safe State and ViewModel delegates
- 10:22Compose support rememberSerializable
- 12:09How serialization works
- 13:36Encoding primitives to Safe State
- 15:22Encoding collections and nested objects
- 17:10Performance and efficiency
- 18:16Size limits and stability
- 19:19Runtime crashes and type safety
- 20:26Cross-platform support future
related talks
34mCustom Codecs with KotlinX Serialization
24mWhat is Kotlin Serialization, and should I use it?
31mDesign of Kotlin Serialization
43mRepresenting State: the Kotlin Edition
36mPerformant Multiplatform Kotlin Serialization
43mFrom Effective Java to Effective Kotlin
42mPerformant Multiplatform Kotlin Serialization
54mKotlinx.serialization: Building Your Own Serialization Library
