ComposeNavigator
-
Cmn
@Navigator.Name(value = "composable")
class ComposeNavigator : Navigator
Navigator that navigates through Composables. Every destination using this Navigator must set a valid Composable by setting it directly on an instantiated Destination or calling composable.
Summary
Nested types |
|---|
@NavDestination.ClassType(value = Composable)NavDestination specific to |
Public constructors |
|
|---|---|
|
Cmn
|
Public functions |
||
|---|---|---|
open ComposeNavigator.Destination |
Construct a new NavDestination associated with this Navigator. |
Cmn
|
open Unit |
navigate(Navigate to a destination. |
Cmn
|
Unit |
Callback to mark a navigation in transition as complete. |
Cmn
|
open Unit |
popBackStack(popUpTo: NavBackStackEntry, savedState: Boolean)Attempt to pop this navigator's back stack, performing the appropriate navigation. |
Cmn
|
Unit |
Function to prepare the entry for transition. |
Cmn
|
Public properties |
||
|---|---|---|
StateFlow<List<NavBackStackEntry>> |
Get the back stack from the |
Cmn
|
Inherited functions |
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Inherited properties |
||||||
|---|---|---|---|---|---|---|
|
Public constructors
Public functions
createDestination
open fun createDestination(): ComposeNavigator.Destination
Construct a new NavDestination associated with this Navigator.
Any initialization of the destination should be done in the destination's constructor as it is not guaranteed that every destination will be created through this method.
| Returns | |
|---|---|
ComposeNavigator.Destination |
a new NavDestination |
navigate
open fun navigate(
entries: List<NavBackStackEntry>,
navOptions: NavOptions?,
navigatorExtras: Navigator.Extras?
): Unit
Navigate to a destination.
Requests navigation to a given destination associated with this navigator in the navigation graph. This method generally should not be called directly; NavController will delegate to it when appropriate.
| Parameters | |
|---|---|
entries: List<NavBackStackEntry> |
destination(s) to navigate to |
navOptions: NavOptions? |
additional options for navigation |
navigatorExtras: Navigator.Extras? |
extras unique to your Navigator. |
onTransitionComplete
fun onTransitionComplete(entry: NavBackStackEntry): Unit
Callback to mark a navigation in transition as complete.
This should be called in conjunction with navigate and popBackStack as those calls merely start a transition to the target destination, and requires manually marking the transition as complete by calling this method.
Failing to call this method could result in entries being prevented from reaching their final Lifecycle.State.
popBackStack
open fun popBackStack(popUpTo: NavBackStackEntry, savedState: Boolean): Unit
Attempt to pop this navigator's back stack, performing the appropriate navigation.
All destinations back to popUpTo should be popped off the back stack.
| Parameters | |
|---|---|
popUpTo: NavBackStackEntry |
the entry that should be popped off the NavigatorState.backStack along with all entries above this entry. |
savedState: Boolean |
whether any Navigator specific state associated with |
prepareForTransition
fun prepareForTransition(entry: NavBackStackEntry): Unit
Function to prepare the entry for transition.
This should be called when the entry needs to move the Lifecycle.State in preparation for a transition such as when using predictive back.