@NavDestinationDsl
class DynamicNavGraphBuilder : NavGraphBuilder


DSL for constructing a new DynamicGraphNavigator.DynamicNavGraph

Summary

Public constructors

DynamicNavGraphBuilder(
    provider: NavigatorProvider,
    id: @IdRes Int,
    startDestination: @IdRes Int
)

This function is deprecated. Use routes to create your DynamicNavGraphBuilder instead

DynamicNavGraphBuilder(
    provider: NavigatorProvider,
    startDestination: String,
    route: String?
)
@ExperimentalSafeArgsApi
DynamicNavGraphBuilder(
    provider: NavigatorProvider,
    startDestination: Any,
    route: KClass<*>?,
    typeMap: Map<KTypeNavType<*>>
)

DSL for constructing a new DynamicGraphNavigator.DynamicNavGraph

@ExperimentalSafeArgsApi
DynamicNavGraphBuilder(
    provider: NavigatorProvider,
    startDestination: KClass<*>,
    route: KClass<*>?,
    typeMap: Map<KTypeNavType<*>>
)

DSL for constructing a new DynamicGraphNavigator.DynamicNavGraph

Public functions

open NavGraph

Public properties

String?

The module name of this Destination's dynamic feature module.

Int

ID of the destination displayed during module installation.

String?

Route of the destination displayed during module installation.

Extension functions

inline Unit

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

inline Unit

Construct a new DynamicActivityNavigator.Destination

inline Unit

Construct a new DynamicActivityNavigator.Destination

inline Unit

This function is deprecated. Use routes to create your DynamicFragmentDestination instead

inline Unit

Construct a new DynamicFragmentNavigator.Destination

inline Unit

Construct a new DynamicFragmentNavigator.Destination

inline Unit

This function is deprecated. Use routes to create your DynamicFragmentDestination instead

inline Unit

Construct a new DynamicFragmentNavigator.Destination

inline Unit

Construct a new DynamicFragmentNavigator.Destination

inline Unit
@ExperimentalSafeArgsApi
<T : Any> DynamicNavGraphBuilder.fragment(
    fragmentClassName: String,
    typeMap: Map<KTypeNavType<*>>,
    builder: DynamicFragmentNavigatorDestinationBuilder.() -> Unit
)

Construct a new DynamicFragmentNavigator.Destination

inline Unit
DynamicNavGraphBuilder.fragment(
    id: @IdRes Int,
    fragmentClassName: String,
    builder: DynamicFragmentNavigatorDestinationBuilder.() -> Unit
)

This function is deprecated. Use routes to create your DynamicFragmentDestination instead

inline Unit
DynamicNavGraphBuilder.fragment(
    route: String,
    fragmentClassName: String,
    builder: DynamicFragmentNavigatorDestinationBuilder.() -> Unit
)

Construct a new DynamicFragmentNavigator.Destination

inline Unit
DynamicNavGraphBuilder.includeDynamic(
    id: @IdRes Int,
    moduleName: String,
    graphResourceName: String
)

This function is deprecated. Use routes to include your DynamicNavGraph instead

inline Unit
@ExperimentalSafeArgsApi
<T : Any> DynamicNavGraphBuilder.includeDynamic(
    moduleName: String,
    graphResourceName: String,
    typeMap: Map<KTypeNavType<*>>
)

Construct a new DynamicIncludeGraphNavigator.DynamicIncludeNavGraph.

inline Unit
DynamicNavGraphBuilder.includeDynamic(
    route: String,
    moduleName: String,
    graphResourceName: String
)

Construct a new DynamicIncludeGraphNavigator.DynamicIncludeNavGraph.

inline Unit
DynamicNavGraphBuilder.includeDynamic(
    id: @IdRes Int,
    moduleName: String,
    graphResourceName: String,
    builder: DynamicIncludeNavGraphBuilder.() -> Unit
)

This function is deprecated. Use routes to include your DynamicNavGraph instead

inline Unit
@ExperimentalSafeArgsApi
<T : Any> DynamicNavGraphBuilder.includeDynamic(
    moduleName: String,
    graphResourceName: String,
    typeMap: Map<KTypeNavType<*>>,
    builder: DynamicIncludeNavGraphBuilder.() -> Unit
)

Construct a new DynamicIncludeGraphNavigator.DynamicIncludeNavGraph.

inline Unit
DynamicNavGraphBuilder.includeDynamic(
    route: String,
    moduleName: String,
    graphResourceName: String,
    builder: DynamicIncludeNavGraphBuilder.() -> Unit
)

Construct a new DynamicIncludeGraphNavigator.DynamicIncludeNavGraph.

inline Unit
DynamicNavGraphBuilder.navigation(
    id: @IdRes Int,
    startDestination: @IdRes Int,
    builder: DynamicNavGraphBuilder.() -> Unit
)

This function is deprecated. Use routes to create your DynamicNavGraph instead

inline Unit
@ExperimentalSafeArgsApi
<T : Any> DynamicNavGraphBuilder.navigation(
    startDestination: Any,
    typeMap: Map<KTypeNavType<*>>,
    builder: DynamicNavGraphBuilder.() -> Unit
)

Construct a nested DynamicGraphNavigator.DynamicNavGraph

inline Unit
@ExperimentalSafeArgsApi
<T : Any> DynamicNavGraphBuilder.navigation(
    startDestination: KClass<*>,
    typeMap: Map<KTypeNavType<*>>,
    builder: DynamicNavGraphBuilder.() -> Unit
)

Construct a nested DynamicGraphNavigator.DynamicNavGraph

inline Unit
DynamicNavGraphBuilder.navigation(
    startDestination: String,
    route: String,
    builder: DynamicNavGraphBuilder.() -> Unit
)

Construct a nested DynamicGraphNavigator.DynamicNavGraph

Inherited functions

From androidx.navigation.NavDestinationBuilder
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.

Unit
argument(name: String, argument: NavArgument)

Add a NavArgument to this destination.

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

Add a deep link to this destination.

Unit
deepLink(navDeepLink: NavDeepLink)

Add a deep link to this destination.

Unit
deepLink(uriPattern: String)

Add a deep link to this destination.

open NavGraph

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

From androidx.navigation.NavGraphBuilder
Unit

Add the destination to the NavGraphBuilder

Unit
<D : NavDestination> destination(navDestination: NavDestinationBuilder<D>)

Build and add a new destination to the NavGraphBuilder

operator Unit

Adds this destination to the NavGraphBuilder

Inherited properties

From androidx.navigation.NavDestinationBuilder
Int

The destination's unique ID.

CharSequence?

The descriptive label of the destination

Navigator<NavGraph>

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

String?

The destination's unique route.

From androidx.navigation.NavGraphBuilder

Public constructors

DynamicNavGraphBuilder

Added in 2.3.0
Deprecated in 2.4.0
DynamicNavGraphBuilder(
    provider: NavigatorProvider,
    id: @IdRes Int,
    startDestination: @IdRes Int
)

DynamicNavGraphBuilder

Added in 2.4.0
DynamicNavGraphBuilder(
    provider: NavigatorProvider,
    startDestination: String,
    route: String? = null
)

DynamicNavGraphBuilder

Added in 2.8.0-alpha07
@ExperimentalSafeArgsApi
DynamicNavGraphBuilder(
    provider: NavigatorProvider,
    startDestination: Any,
    route: KClass<*>?,
    typeMap: Map<KTypeNavType<*>>
)

DSL for constructing a new DynamicGraphNavigator.DynamicNavGraph

Parameters
provider: NavigatorProvider

navigator used to create the destination

startDestination: Any

the starting destination's route as an Object for this NavGraph. The respective NavDestination must be added with route from a KClass in order to match.

route: KClass<*>?

the graph's unique route as a KClass

typeMap: Map<KTypeNavType<*>>

A mapping of KType to custom NavType<*> in the route. May be empty if route does not use custom NavTypes.

Returns
DynamicNavGraphBuilder

the newly created NavGraph

DynamicNavGraphBuilder

Added in 2.8.0-alpha07
@ExperimentalSafeArgsApi
DynamicNavGraphBuilder(
    provider: NavigatorProvider,
    startDestination: KClass<*>,
    route: KClass<*>?,
    typeMap: Map<KTypeNavType<*>>
)

DSL for constructing a new DynamicGraphNavigator.DynamicNavGraph

Parameters
provider: NavigatorProvider

navigator used to create the destination

startDestination: KClass<*>

the starting destination's route as a KClass for this NavGraph. The respective NavDestination must be added with route from a KClass in order to match.

route: KClass<*>?

the graph's unique route as a KClass

typeMap: Map<KTypeNavType<*>>

A mapping of KType to custom NavType<*> in the route. May be empty if route does not use custom NavTypes.

Returns
DynamicNavGraphBuilder

the newly created NavGraph

Public functions

build

open fun build(): NavGraph

Public properties

moduleName

Added in 2.3.0
var moduleNameString?

The module name of this Destination's dynamic feature module. This has to be the same as defined in the dynamic feature module's AndroidManifest.xml file.

progressDestination

Added in 2.3.0
var progressDestinationInt

ID of the destination displayed during module installation. This generally does not need to be set, but is instead filled in by the NavHost via DynamicGraphNavigator.installDefaultProgressDestination.

Setting this clears any previously set progressDestinationRoute.

progressDestinationRoute

Added in 2.4.0
var progressDestinationRouteString?

Route of the destination displayed during module installation. This generally does not need to be set, but is instead filled in by the NavHost via DynamicGraphNavigator.installDefaultProgressDestination.

Setting this overrides any previously set progressDestination.

Extension functions

inline fun DynamicNavGraphBuilder.activity(id: @IdRes Int, builder: DynamicActivityNavigatorDestinationBuilder.() -> Unit): Unit

Construct a new DynamicActivityNavigator.Destination

Parameters
id: @IdRes Int

Destination id.

@ExperimentalSafeArgsApi
inline fun <T : Any> DynamicNavGraphBuilder.activity(
    typeMap: Map<KTypeNavType<*>> = emptyMap(),
    builder: DynamicActivityNavigatorDestinationBuilder.() -> Unit
): Unit

Construct a new DynamicActivityNavigator.Destination

Parameters
<T : Any>

Destination route from a KClass

typeMap: Map<KTypeNavType<*>> = emptyMap()

A mapping of KType to custom NavType<*> in the T. May be empty if T does not use custom NavTypes.

builder: DynamicActivityNavigatorDestinationBuilder.() -> Unit

the builder used to construct the graph

inline fun <F : Fragment> DynamicNavGraphBuilder.fragment(id: @IdRes Int): Unit

Construct a new DynamicFragmentNavigator.Destination

Parameters
id: @IdRes Int

Destination id.

inline fun <F : Fragment> DynamicNavGraphBuilder.fragment(route: String): Unit

Construct a new DynamicFragmentNavigator.Destination

Parameters
route: String

Destination route.

@ExperimentalSafeArgsApi
inline fun <F : Fragment, T : Any> DynamicNavGraphBuilder.fragment(
    typeMap: Map<KTypeNavType<*>> = emptyMap()
): Unit

Construct a new DynamicFragmentNavigator.Destination

Parameters
<T : Any>

the destination's unique route from a KClass

typeMap: Map<KTypeNavType<*>> = emptyMap()

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

inline fun <F : Fragment> DynamicNavGraphBuilder.fragment(
    id: @IdRes Int,
    builder: DynamicFragmentNavigatorDestinationBuilder.() -> Unit
): Unit

Construct a new DynamicFragmentNavigator.Destination

Parameters
id: @IdRes Int

Destination id.

inline fun <F : Fragment> DynamicNavGraphBuilder.fragment(
    route: String,
    builder: DynamicFragmentNavigatorDestinationBuilder.() -> Unit
): Unit

Construct a new DynamicFragmentNavigator.Destination

Parameters
route: String

Destination route.

@ExperimentalSafeArgsApi
inline fun <F : Fragment, T : Any> DynamicNavGraphBuilder.fragment(
    typeMap: Map<KTypeNavType<*>> = emptyMap(),
    builder: DynamicFragmentNavigatorDestinationBuilder.() -> Unit
): Unit

Construct a new DynamicFragmentNavigator.Destination

Parameters
<T : Any>

the destination's unique route from a KClass

typeMap: Map<KTypeNavType<*>> = emptyMap()

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

@ExperimentalSafeArgsApi
inline fun <T : Any> DynamicNavGraphBuilder.fragment(
    fragmentClassName: String,
    typeMap: Map<KTypeNavType<*>> = emptyMap(),
    builder: DynamicFragmentNavigatorDestinationBuilder.() -> Unit
): Unit

Construct a new DynamicFragmentNavigator.Destination

Parameters
<T : Any>

the destination's unique route from a KClass

fragmentClassName: String

Fully qualified class name of destination Fragment.

typeMap: Map<KTypeNavType<*>> = emptyMap()

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

inline fun DynamicNavGraphBuilder.fragment(
    id: @IdRes Int,
    fragmentClassName: String,
    builder: DynamicFragmentNavigatorDestinationBuilder.() -> Unit
): Unit

Construct a new DynamicFragmentNavigator.Destination

Parameters
id: @IdRes Int

Destination id.

fragmentClassName: String

Fully qualified class name of destination Fragment.

inline fun DynamicNavGraphBuilder.fragment(
    route: String,
    fragmentClassName: String,
    builder: DynamicFragmentNavigatorDestinationBuilder.() -> Unit
): Unit

Construct a new DynamicFragmentNavigator.Destination

Parameters
route: String

Destination route.

fragmentClassName: String

Fully qualified class name of destination Fragment.

inline fun DynamicNavGraphBuilder.includeDynamic(
    id: @IdRes Int,
    moduleName: String,
    graphResourceName: String
): Unit

Construct a new DynamicIncludeGraphNavigator.DynamicIncludeNavGraph.

Parameters
id: @IdRes Int

NavGraph id.

moduleName: String

Dynamic feature module name as defined in the module's AndroidManifest. This must not be an empty string.

graphResourceName: String

Graph's resource name without the navigation qualifier. This must not be an empty string.

@ExperimentalSafeArgsApi
inline fun <T : Any> DynamicNavGraphBuilder.includeDynamic(
    moduleName: String,
    graphResourceName: String,
    typeMap: Map<KTypeNavType<*>> = emptyMap()
): Unit

Construct a new DynamicIncludeGraphNavigator.DynamicIncludeNavGraph.

Parameters
<T : Any>

the graph's unique route as a KClass

moduleName: String

Dynamic feature module name as defined in the module's AndroidManifest. This must not be an empty string.

graphResourceName: String

Graph's resource name without the navigation qualifier. This must not be an empty string.

typeMap: Map<KTypeNavType<*>> = emptyMap()

A mapping of KType to custom NavType<*> in the T. May be empty if T does not use custom NavTypes.

inline fun DynamicNavGraphBuilder.includeDynamic(
    route: String,
    moduleName: String,
    graphResourceName: String
): Unit

Construct a new DynamicIncludeGraphNavigator.DynamicIncludeNavGraph.

Parameters
route: String

NavGraph route.

moduleName: String

Dynamic feature module name as defined in the module's AndroidManifest. This must not be an empty string.

graphResourceName: String

Graph's resource name without the navigation qualifier. This must not be an empty string.

inline fun DynamicNavGraphBuilder.includeDynamic(
    id: @IdRes Int,
    moduleName: String,
    graphResourceName: String,
    builder: DynamicIncludeNavGraphBuilder.() -> Unit
): Unit

Construct a new DynamicIncludeGraphNavigator.DynamicIncludeNavGraph.

Parameters
id: @IdRes Int

NavGraph id.

moduleName: String

Dynamic feature module name as defined in the module's AndroidManifest. This must not be an empty string.

graphResourceName: String

Graph's resource name without the navigation qualifier. This must not be an empty string.

builder: DynamicIncludeNavGraphBuilder.() -> Unit

Another builder for chaining.

@ExperimentalSafeArgsApi
inline fun <T : Any> DynamicNavGraphBuilder.includeDynamic(
    moduleName: String,
    graphResourceName: String,
    typeMap: Map<KTypeNavType<*>> = emptyMap(),
    builder: DynamicIncludeNavGraphBuilder.() -> Unit
): Unit

Construct a new DynamicIncludeGraphNavigator.DynamicIncludeNavGraph.

Parameters
<T : Any>

the graph's unique route as a KClass

moduleName: String

Dynamic feature module name as defined in the module's AndroidManifest. This must not be an empty string.

graphResourceName: String

Graph's resource name without the navigation qualifier. This must not be an empty string.

typeMap: Map<KTypeNavType<*>> = emptyMap()

A mapping of KType to custom NavType<*> in the T. May be empty if T does not use custom NavTypes.

builder: DynamicIncludeNavGraphBuilder.() -> Unit

Another builder for chaining.

inline fun DynamicNavGraphBuilder.includeDynamic(
    route: String,
    moduleName: String,
    graphResourceName: String,
    builder: DynamicIncludeNavGraphBuilder.() -> Unit
): Unit

Construct a new DynamicIncludeGraphNavigator.DynamicIncludeNavGraph.

Parameters
route: String

NavGraph route.

moduleName: String

Dynamic feature module name as defined in the module's AndroidManifest. This must not be an empty string.

graphResourceName: String

Graph's resource name without the navigation qualifier. This must not be an empty string.

builder: DynamicIncludeNavGraphBuilder.() -> Unit

Another builder for chaining.

inline fun DynamicNavGraphBuilder.navigation(
    id: @IdRes Int,
    startDestination: @IdRes Int,
    builder: DynamicNavGraphBuilder.() -> Unit
): Unit

Construct a nested DynamicGraphNavigator.DynamicNavGraph

Parameters
id: @IdRes Int

NavGraph id.

startDestination: @IdRes Int

Id start destination in the graph

builder: DynamicNavGraphBuilder.() -> Unit

Another builder for chaining.

@ExperimentalSafeArgsApi
inline fun <T : Any> DynamicNavGraphBuilder.navigation(
    startDestination: Any,
    typeMap: Map<KTypeNavType<*>> = emptyMap(),
    builder: DynamicNavGraphBuilder.() -> Unit
): Unit

Construct a nested DynamicGraphNavigator.DynamicNavGraph

Parameters
<T : Any>

the graph's unique route as a KClass

startDestination: Any

the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added with route from a KClass in order to match.

typeMap: Map<KTypeNavType<*>> = emptyMap()

A mapping of KType to custom NavType<*> in the T. May be empty if T does not use custom NavTypes.

builder: DynamicNavGraphBuilder.() -> Unit

Another builder for chaining.

@ExperimentalSafeArgsApi
inline fun <T : Any> DynamicNavGraphBuilder.navigation(
    startDestination: KClass<*>,
    typeMap: Map<KTypeNavType<*>> = emptyMap(),
    builder: DynamicNavGraphBuilder.() -> Unit
): Unit

Construct a nested DynamicGraphNavigator.DynamicNavGraph

Parameters
<T : Any>

the graph's unique route as a KClass

startDestination: KClass<*>

the starting destination's route from a KClass for this NavGraph. The respective NavDestination must be added with route from a KClass in order to match.

typeMap: Map<KTypeNavType<*>> = emptyMap()

A mapping of KType to custom NavType<*> in the T. May be empty if T does not use custom NavTypes.

builder: DynamicNavGraphBuilder.() -> Unit

Another builder for chaining.

inline fun DynamicNavGraphBuilder.navigation(
    startDestination: String,
    route: String,
    builder: DynamicNavGraphBuilder.() -> Unit
): Unit

Construct a nested DynamicGraphNavigator.DynamicNavGraph

Parameters
startDestination: String

route start destination in the graph

route: String

NavGraph route.

builder: DynamicNavGraphBuilder.() -> Unit

Another builder for chaining.