navigator icon indicating copy to clipboard operation
navigator copied to clipboard

Access Argument in ViewModel for Navigator Compose

Open shakil807g opened this issue 2 years ago • 1 comments

Is it possible to get Navigation arguments from SavedStateHandle in ViewModels like we can do in Navigation Compose library

private val lectionName: String = savedStateHandle.get("lectionName")!!
private val packName: String = savedStateHandle.get("packName")!!

shakil807g avatar Aug 31 '22 11:08 shakil807g

Yes it is possible, but I have to double check in what form the keys and values are stored.

Because savedstatehandle should know about all the states that were saved for a particular component like activity or fragment here composable screen.

KaustubhPatange avatar Sep 01 '22 13:09 KaustubhPatange