NavGraphNavigator



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

android

Public functions

open NavGraph

Creates a new NavGraph associated with this navigator.

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

Public properties

StateFlow<List<NavBackStackEntry>>

Gets the backstack of NavBackStackEntry associated with this Navigator

android

Inherited functions

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

Navigate to a destination.

android
open Unit

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

android
open Unit

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

android
open Unit
onRestoreState(savedState: Bundle)

Restore any state previously saved in onSaveState.

android
open Bundle?

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

android
open Boolean

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

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

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

android

Inherited properties

From androidx.navigation.Navigator
Boolean

Whether this Navigator is actively being used by a NavController.

android
NavigatorState

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

android

Public constructors

NavGraphNavigator(navigatorProvider: NavigatorProvider)
Parameters
navigatorProvider: NavigatorProvider

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

Public functions

createDestination

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

val backStackStateFlow<List<NavBackStackEntry>>

Gets the backstack of NavBackStackEntry associated with this Navigator