NavDestinationBuilder


Known indirect subclasses

DSL for constructing a new NavDestination

Summary

Public constructors

<D : NavDestination> NavDestinationBuilder(
    navigator: Navigator<D>,
    route: String?
)

DSL for constructing a new NavDestination with a unique route.

Cmn
android
<D : NavDestination> NavDestinationBuilder(
    navigator: Navigator<D>,
    route: KClass<*>?,
    typeMap: Map<KTypeNavType<*>>
)

DSL for constructing a new NavDestination with a serializable KClass.

Cmn
android

Public functions

Unit
argument(name: String, argumentBuilder: NavArgumentBuilder.() -> Unit)

Add a NavArgument to this destination.

Cmn
android
Unit
argument(name: String, argument: NavArgument)

Add a NavArgument to this destination.

Cmn
android
open D

Build the NavDestination by calling Navigator.createDestination.

Cmn
android
inline Unit
<T : Any> deepLink(basePath: String)

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
<T : Any> deepLink(uriPattern: String)

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

Protected functions

open D

Instantiate a new instance of D that will be passed to build.

Cmn
android

Public properties

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 instantiateDestination to create the destination.

Cmn
android

Public constructors

<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 NavDestination

<D : NavDestination> NavDestinationBuilder(
    navigator: Navigator<D>,
    route: KClass<*>?,
    typeMap: Map<KTypeNavType<*>>
)

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 KClass of the destination

typeMap: Map<KTypeNavType<*>>

map of destination arguments' kotlin type KType to its respective custom NavType. May be empty if destination does not use custom NavTypes.

Returns
NavDestinationBuilder<D>

the newly constructed NavDestination

Public functions

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.

build

open fun build(): D

Build the NavDestination by calling Navigator.createDestination.

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.com will match http://www.example.com and https://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 arguments SavedState with a key of the same name. For example, http://www.example.com/users/{id} will match http://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.com will match http://www.example.com and https://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 arguments SavedState with a key of the same name. For example, http://www.example.com/users/{id} will match http://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.com will match http://www.example.com and https://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 arguments SavedState with a key of the same name. For example, http://www.example.com/users/{id} will match http://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.

Public properties

label

var labelCharSequence?

The descriptive label of the destination

route

val routeString?

The destination's unique route.

Protected properties

protected val navigatorNavigator<D>

The navigator the destination that will be used in instantiateDestination to create the destination.