13

In Android Compose navigation, navigation arguments are populated in SavedStateHandle which can then be accessed in a ViewModel. I have done this in practice and implementation is well outlined here: https://stackoverflow.com/a/69145748/12385518.

My problem is I cannot find any documentation on why/how this is happening. In fact I cannot even find official documentation that even mention navigation arguments being in SavedStateHandle at all. I would love to read more about this. I have read these documents (and more) but found nothing on the topic:

https://developer.android.com/topic/libraries/architecture/viewmodel-savedstate https://developer.android.com/reference/androidx/lifecycle/SavedStateHandled

It seems to be a very nice technique for passing around navigation arguments, however since it isn't mentioned anywhere I am considering transitioning to another technique.

Lucas
  • 323
  • 1
  • 8

0 Answers0