Does anyone know why the `NavDestination.id` is an...
# compose-android
j
Does anyone know why the
NavDestination.id
is annotated with:
Copy code
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
In the JetBrains navigation library the same property in the native AndroidX Navigation library is publicly accessible.
đź‘€ 1
s
Do you have a link to the JB code which is different from the androidx code? And what are you doing with the ID where you need access to it?
j
I’m not sure how to link to the code externally. Reviewing the source in Android studio is how I’m able to see the difference. I need the
id
to “pop” the navigation stack to to handle top level navigation similar to “Now In Android”.
s
You can link it from cs.android.com and from the JB GitHub repository. In order to pop to a specific destination you shouldn't do it using an id, but using the public APIs available to you like here https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:navigation/navigation-common/src/commonMain/kotlin/androidx/navigation/NavOptionsBuilder.kt;l=90 where you can do so using the type-safe navigation APIs.
j
Id
is in the public API on Android. I got my example from NowInAndroid. The problem is I’m trying to adapt this solution to Compose Multiplatform.
s
Can you link where NowInAndroid does this?