Android, Jetpack Compose, Navigation, Type Safety, Kotlin.
data class, we’ll add this companion object: @Serializable data class BookDetail(val book: Book) { companion object { val typeMap = mapOf(typeOf<Book>() to serializableType<Book>()) fun from(savedStateHandle: SavedStateHandle) = savedStateHandle.toRoute<BookDetail>(typeMap) } } Therefore, we can