navigate

Navigates to key, picking the behaviour from what kind of destination it is:

  • the current top-level destination: pops its stack back to its root, the standard "tap the selected tab again to go home" gesture

  • another top-level destination: switches to it, preserving where the user was

  • anything else: pushes onto the current top-level destination's stack

A non-top-level key must belong to exactly one top-level destination. Pushing the same key from two different tabs puts it in NavigationState.backStack twice, and Navigation 3 identifies an entry by NavEntry.contentKey, which defaults to key.toString(). Duplicate content keys share decorator state and can fail when rendered together. Distinct arguments on a data-class key produce distinct content keys; sharing a key type alone is not a collision. For independent instances across tabs, use distinct stable keys and verify restoration. See entry identity.