It took me ages to find this ‘documentation’ on cu...
# compose
t
It took me ages to find this ‘documentation’ on custom
NavType
in Jetpack Navigation. You shouldn’t have to lean on this too often, as it’s not considered good practice to pass structured data via navigation arguments if you’re using route-based navigation. Instead, it’s better to pass an identifier for your data, and then go and retrieve it from your repository - if you can. But, if your data isn’t uniquely-identifiable, or it only really exists at the UI layer, then there are times when it can be useful to serialize your structured data and pass it around. That’s where custom
NavType
comes in handy - and there’s a little explanation of how to do it, buried in this guide to the navigation DSL: https://developer.android.com/guide/navigation/navigation-kotlin-dsl#custom-types
v
It might be a shameless plug, but very recently I made a tutorial about it.

https://www.youtube.com/watch?v=MeTbydjEc90

You can check it out if you want.