-
- All Implemented Interfaces:
-
com.ramcosta.composedestinations.spec.RouteOrDirection
public interface TypedRoute<NAV_ARGS extends Object> implements RouteOrDirection
Interface for all classes which instances are identified by a route.
All TypedDestinationSpec and TypedNavGraphSpec are TypedRoute.
TypedRoute instances are not suitable to be navigated to unless they're also Direction.
-
-
Method Summary
Modifier and Type Method Description abstract Directioninvoke(NAV_ARGS navArgs)Function to get a Direction you can then pass to com.ramcosta.composedestinations.navigation.DestinationsNavigator or to NavController.navigateTo() to safely navigate to this Destination. abstract NAV_ARGSargsFrom(Bundle bundle)Method that returns the navigation arguments class of this Composable for the bundle when the destination gets navigated to. abstract NAV_ARGSargsFrom(SavedStateHandle savedStateHandle)Method that returns the navigation arguments class of this Composable for the savedStateHandle. NAV_ARGSargsFrom(NavBackStackEntry navBackStackEntry)Method that returns the navigation arguments class of this Composable for the navBackStackEntry when the destination gets navigated to. abstract StringgetRoute()Full route pattern that will be added to the navigation graph. abstract StringgetBaseRoute()Prefix of the route - basically route without argument info. List<NamedNavArgument>getArguments()List<NavDeepLink>getDeepLinks()-
-
Method Detail
-
invoke
abstract Direction invoke(NAV_ARGS navArgs)
Function to get a Direction you can then pass to com.ramcosta.composedestinations.navigation.DestinationsNavigator or to NavController.navigateTo() to safely navigate to this Destination.
-
argsFrom
abstract NAV_ARGS argsFrom(Bundle bundle)
Method that returns the navigation arguments class of this Composable for the bundle when the destination gets navigated to.
-
argsFrom
abstract NAV_ARGS argsFrom(SavedStateHandle savedStateHandle)
Method that returns the navigation arguments class of this Composable for the savedStateHandle. This is useful when the SavedStateHandle is created with the navigation arguments, for example, inside the ViewModel.
If you're manually creating the ViewModel, use the
AbstractSavedStateViewModelFactoryand pass the NavBackStackEntry.arguments as the second constructor parameter. If you're using something like Hilt, then that is done for you out of the box.
-
argsFrom
NAV_ARGS argsFrom(NavBackStackEntry navBackStackEntry)
Method that returns the navigation arguments class of this Composable for the navBackStackEntry when the destination gets navigated to.
-
getRoute
abstract String getRoute()
Full route pattern that will be added to the navigation graph. Navigation arguments are not filled in.
-
getBaseRoute
abstract String getBaseRoute()
Prefix of the route - basically route without argument info.
-
getArguments
List<NamedNavArgument> getArguments()
-
getDeepLinks
List<NavDeepLink> getDeepLinks()
-
-
-
-