ViewModel - SavedStateHandle
val viewModel = ViewModelProvider(this, SavedStateVMFactory(this))
.get(MyViewModel::class.java)
class MyViewModel(val state : SavedStateHandle) : ViewModel() {
fun saveProductId(productId: String) {
state.set("productId", productId)
}
fun getProductId(): String {
return state.get("productId")?: ""
}
}