Quantcast
Viewing latest article 17
Browse Latest Browse All 74

where the creation point of the savedStateHandle[key, value] map?

first, sorry for my bad eng.

https://github.com/google-developer-training/basic-android-kotlin-compose-training-inventory-app/tree/main

using this app and

https://developer.android.com/codelabs/basic-android-kotlin-compose-update-data-room?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-6-pathway-2%3Fhl%3Dko%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-update-data-room#5

reading this chapter

class ItemDetailsViewModel has a statement below.

private val itemId: Int = checkNotNull(savedStateHandle[ItemDetailsDestination.itemIdArg])

I have known savedStateHandle must have a setting section likeoperator fun set(key: String, value: Any?) { initialState[key] = value }

so savedStateHandle loads the value using the key.

At this point, I couldn't find savedStateHandle set his value using ItemDetailsDestination.itemIdArg key in the app.

Asking ChatGPT, savedStateHandle can't create value automatically, they must directly set the key-value map. But also ChatGPT can't find the setting point.

Am I curious for Being of no use? I can't sleep until I find the answer.Please somebody put me to sleep.


Viewing latest article 17
Browse Latest Browse All 74

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>