Jorge DomĂnguez
05/18/2024, 4:13 AMSavedStateHandle
I'd just set the nav argument key and the value I need before instantiating the ViewModel:
@Before
fun setup() {
savedStateHandle[NAV_ARGUMENT_KEY] = someValue
viewModel = ViewModel(savedStateHandle)
}
Is there a way I can do that with the new type-safe APIs? In my ViewModel I'm using toRoute()
to get the serializable that represents the nav destination, but I can't figure out how to do the inverse and somehow "save" the serializable into the SavedStateHandle
.Ian Lake
05/18/2024, 4:42 AMIan Lake
05/18/2024, 4:43 AMnavigation-testing
artifact and use the SavedStateHandle(yourSerializableInstance)
Ian Lake
05/18/2024, 4:45 AMJorge DomĂnguez
05/18/2024, 6:04 AM