NavGraphNavigator


@Navigator.Name(value = "navigation")
open class NavGraphNavigator : Navigator

Known direct subclasses
DynamicGraphNavigator

Navigator for graphs in dynamic feature modules.


A Navigator built specifically for NavGraph elements. Handles navigating to the correct destination when the NavGraph is the target of navigation actions.

Construct a Navigator capable of routing incoming navigation requests to the proper destination within a NavGraph.

Summary

Public constructors

Public functions

open NavGraph

Creates a new NavGraph associated with this navigator.

open Unit
navigate(
    entries: List<NavBackStackEntry>,
    navOptions: NavOptions?,
    navigatorExtras: Navigator.Extras?
)

Public properties

StateFlow<List<NavBackStackEntry>>

Gets the backstack of NavBackStackEntry associated with this Navigator

Inherited functions

From androidx.navigation.Navigator
open NavDestination?
navigate(
    destination: NavGraph,
    args: SavedState?,
    navOptions: NavOptions?,
    navigatorExtras: Navigator.Extras?
)

Navigate to a destination.

open Unit

Indicator that this Navigator is actively being used by a NavController.

open Unit

Informational callback indicating that the given backStackEntry has been affected by a NavOptions.shouldLaunchSingleTop operation.

open Unit

Restore any state previously saved in onSaveState.

open SavedState?

Called to ask for a SavedState representing the Navigator's state.

open Boolean

Attempt to pop this navigator's back stack, performing the appropriate navigation.

open Unit
popBackStack(popUpTo: NavBackStackEntry, savedState: Boolean)

Attempt to pop this navigator's back stack, performing the appropriate navigation.

Inherited properties

From androidx.navigation.Navigator
Boolean

Whether this Navigator is actively being used by a NavController.

NavigatorState

The state of the Navigator is the communication conduit between the Navigator and the NavController that has called onAttach.

Public constructors

Added in 1.0.0
NavGraphNavigator(navigatorProvider: NavigatorProvider)
Parameters
navigatorProvider: NavigatorProvider

NavigatorProvider used to retrieve the correct Navigator to navigate to the start destination

Public functions

createDestination

Added in 2.9.0-alpha04
open fun createDestination(): NavGraph

Creates a new NavGraph associated with this navigator.

Returns
NavGraph

The created NavGraph.

open fun navigate(
    entries: List<NavBackStackEntry>,
    navOptions: NavOptions?,
    navigatorExtras: Navigator.Extras?
): Unit
Throws
kotlin.IllegalArgumentException

if given destination is not a child of the current navgraph

Public properties

backStack

Added in 2.6.0
val backStackStateFlow<List<NavBackStackEntry>>

Gets the backstack of NavBackStackEntry associated with this Navigator