NavDestinationBuilder
-
Cmn
@NavDestinationDsl
open class NavDestinationBuilder<D : NavDestination>
ActivityNavigatorDestinationBuilder |
DSL for constructing a new |
BottomSheetNavigatorDestinationBuilder |
DSL for constructing a new |
ComposeNavigatorDestinationBuilder |
DSL for constructing a new |
DialogFragmentNavigatorDestinationBuilder |
DSL for constructing a new |
DialogNavigatorDestinationBuilder |
DSL for constructing a new |
DynamicActivityNavigatorDestinationBuilder |
DSL for constructing a new |
DynamicFragmentNavigatorDestinationBuilder |
DSL for constructing a new |
DynamicIncludeNavGraphBuilder |
DSL for constructing a new |
FragmentNavigatorDestinationBuilder |
DSL for constructing a new |
NavGraphBuilder |
DSL for constructing a new |
DynamicNavGraphBuilder |
DSL for constructing a new |
DSL for constructing a new NavDestination
Summary
Public constructors |
|
|---|---|
<D : NavDestination> This function is deprecated. Use routes to build your NavDestination instead |
android
|
<D : NavDestination> NavDestinationBuilder(DSL for constructing a new |
Cmn
android
|
<D : NavDestination> NavDestinationBuilder(DSL for constructing a new |
Cmn
android
|
Public functions |
||
|---|---|---|
Unit |
This function is deprecated. Building NavDestinations using IDs with the Kotlin DSL has been deprecated in favor of using routes. |
android
|
Unit |
argument(name: String, argumentBuilder: NavArgumentBuilder.() -> Unit)Add a |
Cmn
android
|
Unit |
argument(name: String, argument: NavArgument)Add a |
Cmn
android
|
open D |
build()Build the NavDestination by calling |
Cmn
android
|
inline Unit |
Add a deep link to this destination. |
Cmn
android
|
Unit |
deepLink(navDeepLink: NavDeepLinkDslBuilder.() -> Unit)Add a deep link to this destination. |
Cmn
android
|
Unit |
deepLink(navDeepLink: NavDeepLink)Add a deep link to this destination. |
Cmn
android
|
Unit |
Add a deep link to this destination. |
Cmn
android
|
inline Unit |
<T : Any> deepLink(basePath: String, noinline navDeepLink: NavDeepLinkDslBuilder.() -> Unit)Add a deep link to this destination. |
Cmn
android
|
Unit |
<T : Any> deepLink(route: KClass<T>, basePath: String, navDeepLink: NavDeepLinkDslBuilder.() -> Unit)Add a deep link to this destination. |
Cmn
android
|
Protected functions |
||
|---|---|---|
open D |
Instantiate a new instance of |
Cmn
android
|
Public properties |
||
|---|---|---|
@IdRes Int |
The destination's unique ID. |
android
|
CharSequence? |
The descriptive label of the destination |
Cmn
android
|
String? |
The destination's unique route. |
Cmn
android
|
Protected properties |
||
|---|---|---|
Navigator<D> |
The navigator the destination that will be used in |
Cmn
android
|
Public constructors
NavDestinationBuilder
<D : NavDestination>NavDestinationBuilder(
navigator: Navigator<D>,
id: @IdRes Int
)
DSL for constructing a new NavDestination with a unique id.
This sets the destination's route to null.
| Parameters | |
|---|---|
navigator: Navigator<D> |
navigator used to create the destination |
id: @IdRes Int |
the destination's unique id |
| Returns | |
|---|---|
NavDestinationBuilder<D> |
the newly constructed |
NavDestinationBuilder
<D : NavDestination> NavDestinationBuilder(
navigator: Navigator<D>,
route: String?
)
DSL for constructing a new NavDestination with a unique route.
This will also update the id of the destination based on route.
| Parameters | |
|---|---|
navigator: Navigator<D> |
navigator used to create the destination |
route: String? |
the destination's unique route |
| Returns | |
|---|---|
NavDestinationBuilder<D> |
the newly constructed |
NavDestinationBuilder
<D : NavDestination> NavDestinationBuilder(
navigator: Navigator<D>,
route: KClass<*>?,
typeMap: Map<KType, NavType<*>>
)
DSL for constructing a new NavDestination with a serializable KClass.
This will also update the id of the destination based on KClass's serializer.
| Parameters | |
|---|---|
navigator: Navigator<D> |
navigator used to create the destination |
route: KClass<*>? |
the |
typeMap: Map<KType, NavType<*>> |
map of destination arguments' kotlin type |
| Returns | |
|---|---|
NavDestinationBuilder<D> |
the newly constructed |
Public functions
action
funaction(actionId: Int, actionBuilder: NavActionBuilder.() -> Unit): Unit
Adds a new NavAction to the destination
argument
fun argument(name: String, argumentBuilder: NavArgumentBuilder.() -> Unit): Unit
Add a NavArgument to this destination.
argument
fun argument(name: String, argument: NavArgument): Unit
Add a NavArgument to this destination.
deepLink
inline fun <T : Any> deepLink(basePath: String): Unit
Add a deep link to this destination.
The arguments in T are expected to be identical (in name and type) to the arguments in the route from KClass that was used to construct this NavDestinationBuilder.
Extracts deeplink arguments from T and appends it to the basePath. See docs on the safe args version of NavDeepLink.Builder.setUriPattern for the final uriPattern's generation logic.
In addition to a direct Uri match, basePaths without a scheme are assumed as http and https. For example, www.example.com will match http://www.example.com and https://www.example.com.
| Parameters | |
|---|---|
<T : Any> |
The deepLink KClass to extract arguments from |
basePath: String |
The base uri path to append arguments onto |
| See also | |
|---|---|
setUriPattern |
for the final uriPattern's generation logic. |
deepLink
fun deepLink(navDeepLink: NavDeepLinkDslBuilder.() -> Unit): Unit
Add a deep link to this destination.
In addition to a direct Uri match, the following features are supported:
-
Uris without a scheme are assumed as http and https. For example,
www.example.comwill matchhttp://www.example.comandhttps://www.example.com. -
Placeholders in the form of
{placeholder_name}matches 1 or more characters. The String value of the placeholder will be available in the argumentsSavedStatewith a key of the same name. For example,http://www.example.com/users/{id}will matchhttp://www.example.com/users/4. -
The
.*wildcard can be used to match 0 or more characters.
| Parameters | |
|---|---|
navDeepLink: NavDeepLinkDslBuilder.() -> Unit |
the NavDeepLink to be added to this destination |
deepLink
fun deepLink(navDeepLink: NavDeepLink): Unit
Add a deep link to this destination.
In addition to a direct Uri match, the following features are supported:
-
Uris without a scheme are assumed as http and https. For example,
www.example.comwill matchhttp://www.example.comandhttps://www.example.com. -
Placeholders in the form of
{placeholder_name}matches 1 or more characters. The String value of the placeholder will be available in the argumentsSavedStatewith a key of the same name. For example,http://www.example.com/users/{id}will matchhttp://www.example.com/users/4. -
The
.*wildcard can be used to match 0 or more characters.
| Parameters | |
|---|---|
navDeepLink: NavDeepLink |
the NavDeepLink to be added to this destination |
deepLink
fun <T : Any> deepLink(uriPattern: String): Unit
Add a deep link to this destination.
In addition to a direct Uri match, the following features are supported:
-
Uris without a scheme are assumed as http and https. For example,
www.example.comwill matchhttp://www.example.comandhttps://www.example.com. -
Placeholders in the form of
{placeholder_name}matches 1 or more characters. The String value of the placeholder will be available in the argumentsSavedStatewith a key of the same name. For example,http://www.example.com/users/{id}will matchhttp://www.example.com/users/4. -
The
.*wildcard can be used to match 0 or more characters.
| Parameters | |
|---|---|
uriPattern: String |
The uri pattern to add as a deep link |
| See also | |
|---|---|
deepLink |
deepLink
inline fun <T : Any> deepLink(basePath: String, noinline navDeepLink: NavDeepLinkDslBuilder.() -> Unit): Unit
Add a deep link to this destination.
The arguments in T are expected to be identical (in name and type) to the arguments in the route from KClass that was used to construct this NavDestinationBuilder.
Extracts deeplink arguments from T and appends it to the basePath. See docs on the safe args version of NavDeepLink.Builder.setUriPattern for the final uriPattern's generation logic.
In addition to a direct Uri match, basePaths without a scheme are assumed as http and https. For example, www.example.com will match http://www.example.com and https://www.example.com.
| Parameters | |
|---|---|
<T : Any> |
The deepLink KClass to extract arguments from |
basePath: String |
The base uri path to append arguments onto |
noinline navDeepLink: NavDeepLinkDslBuilder.() -> Unit |
the NavDeepLink to be added to this destination |
| See also | |
|---|---|
setUriPattern |
for the final uriPattern's generation logic. |
deepLink
fun <T : Any> deepLink(route: KClass<T>, basePath: String, navDeepLink: NavDeepLinkDslBuilder.() -> Unit): Unit
Add a deep link to this destination.
The arguments in route are expected to be identical (in name and type) to the arguments in the NavDestinationBuilder.route that was used to construct this NavDestinationBuilder.
Extracts deeplink arguments from route and appends it to the basePath. See docs on the safe args version of NavDeepLink.Builder.setUriPattern for the final uriPattern's generation logic.
In addition to a direct Uri match, basePaths without a scheme are assumed as http and https. For example, www.example.com will match http://www.example.com and https://www.example.com.
| Parameters | |
|---|---|
route: KClass<T> |
The deepLink KClass to extract arguments from |
basePath: String |
The base uri path to append arguments onto |
navDeepLink: NavDeepLinkDslBuilder.() -> Unit |
the NavDeepLink to be added to this destination |
| See also | |
|---|---|
setUriPattern |
for the final uriPattern's generation logic. |
Protected functions
instantiateDestination
protected open fun instantiateDestination(): D
Instantiate a new instance of D that will be passed to build.
By default, this calls Navigator.createDestination on navigator, but can be overridden to call a custom constructor, etc.
Protected properties
navigator
protected val navigator: Navigator<D>
The navigator the destination that will be used in instantiateDestination to create the destination.