NavDestinationBuilder

@NavDestinationDsl
open class NavDestinationBuilder<D : NavDestination>

Known indirect subclasses

DSL for constructing a new NavDestination

Summary

Public constructors

<D : NavDestination> NavDestinationBuilder(
    navigator: Navigator<D>,
    id: @IdRes Int
)

This function is deprecated. Use routes to build your NavDestination instead

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

DSL for constructing a new NavDestination with a unique route.

Public functions

Unit
action(actionId: Int, actionBuilder: NavActionBuilder.() -> Unit)

This function is deprecated. Building NavDestinations using IDs with the Kotlin DSL has been deprecated in favor of using routes.

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

Add a NavArgument to this destination.

open D

Build the NavDestination by calling Navigator.createDestination.

Unit
deepLink(navDeepLink: NavDeepLinkDslBuilder.() -> Unit)

Add a deep link to this destination.

Unit
deepLink(uriPattern: String)

Add a deep link to this destination.

Public properties

Int

The destination's unique ID.

CharSequence?

The descriptive label of the destination

String?

The destination's unique route.

Protected properties

Navigator<D>

The navigator the destination was created from

Public constructors

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

<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

Public functions

action

Added in 1.0.0
fun action(actionId: Int, actionBuilder: NavActionBuilder.() -> Unit): Unit

Adds a new NavAction to the destination

argument

Added in 1.0.0
fun argument(name: String, argumentBuilder: NavArgumentBuilder.() -> Unit): Unit

Add a NavArgument to this destination.

build

Added in 1.0.0
open fun build(): D

Build the NavDestination by calling Navigator.createDestination.

deepLink

Added in 2.3.0
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 Bundle 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

Added in 1.0.0
fun 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 Bundle 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

Public properties

id

Added in 1.0.0
val idInt

The destination's unique ID.

label

Added in 1.0.0
var labelCharSequence?

The descriptive label of the destination

route

val routeString?

The destination's unique route.

Protected properties

Added in 1.0.0
protected val navigatorNavigator<D>

The navigator the destination was created from