# NavHost

Artifact: [androidx.navigation:navigation-runtime](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavHost.kt+class:androidx.navigation.NavHost) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

*** ** * ** ***


```
public interface NavHost
```

<br />

Known direct subclasses [NavHostFragment](https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment)

|---|---|
| `https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment` | NavHostFragment provides an area within your layout for self-contained navigation to occur. |

Known indirect subclasses [DynamicNavHostFragment](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/DynamicNavHostFragment)

|---|---|
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/fragment/DynamicNavHostFragment` | The `https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment` for dynamic features. |

*** ** * ** ***

A host is a single context or container for navigation via a `https://developer.android.com/reference/androidx/navigation/NavController`.

It is strongly recommended to construct the nav controller by instantiating a `https://developer.android.com/reference/androidx/navigation/NavHostController`, which offers additional APIs specifically for a NavHost. The NavHostController should still only be externally accessible as a `https://developer.android.com/reference/androidx/navigation/NavController`, rather than directly exposing it as a `https://developer.android.com/reference/androidx/navigation/NavHostController`.

Navigation hosts must:

- Handle `https://developer.android.com/reference/androidx/navigation/NavController#saveState()` and `https://developer.android.com/reference/androidx/navigation/NavController#restoreState(androidx.savedstate.SavedState)` their controller's state

- Call [Navigation.setViewNavController](https://developer.android.com/reference/androidx/navigation/Navigation#setViewNavController(android.view.View,androidx.navigation.NavController)) on their root view

- Route system Back button events to the NavController either by manually calling `https://developer.android.com/reference/androidx/navigation/NavController#popBackStack()` or by calling [NavHostController.setOnBackPressedDispatcher](https://developer.android.com/reference/androidx/navigation/NavHostController#setOnBackPressedDispatcher(androidx.activity.OnBackPressedDispatcher)) when constructing the NavController.

Optionally, a navigation host should consider calling:

- Call `https://developer.android.com/reference/androidx/navigation/NavHostController#setLifecycleOwner(androidx.lifecycle.LifecycleOwner)` to associate the NavController with a specific Lifecycle.

- Call `https://developer.android.com/reference/androidx/navigation/NavHostController#setViewModelStore(androidx.lifecycle.ViewModelStore)` to enable usage of [NavController.getViewModelStoreOwner](https://developer.android.com/reference/androidx/navigation/NavController#getViewModelStoreOwner(kotlin.Int)) and navigation graph scoped ViewModels.

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavController` | `https://developer.android.com/reference/androidx/navigation/NavHost#getNavController()()` The `https://developer.android.com/reference/androidx/navigation/NavController` for this navigation host. |

| ### Extension functions |
|---|---|
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph` | `https://developer.android.com/reference/androidx/navigation/NavHostKt.[createGraph](https://developer.android.com/reference/androidx/navigation/NavHost#(androidx.navigation.NavHost).createGraph(kotlin.Int,kotlin.Int,kotlin.Function1))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavHost receiver, @https://developer.android.com/reference/androidx/annotation/IdRes int id, @https://developer.android.com/reference/androidx/annotation/IdRes int startDestination, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder )` **This method is deprecated.** Use routes to create your NavGraph instead |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph` | `https://developer.android.com/reference/androidx/navigation/NavHostKt.[createGraph](https://developer.android.com/reference/androidx/navigation/NavHost#(androidx.navigation.NavHost).createGraph(kotlin.Int,kotlin.Int,kotlin.Function1))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavHost receiver, @https://developer.android.com/reference/androidx/annotation/IdRes int id, @https://developer.android.com/reference/androidx/annotation/IdRes int startDestination, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder )` **This method is deprecated.** Use routes to create your dynamic NavGraph instead |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph` | `https://developer.android.com/reference/androidx/navigation/NavHostKt.https://developer.android.com/reference/androidx/navigation/NavHost#(androidx.navigation.NavHost).createGraph(kotlin.String,kotlin.String,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavHost receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html startDestination, https://developer.android.com/reference/java/lang/String.html route, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder )` Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph` |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph` | `https://developer.android.com/reference/androidx/navigation/NavHostKt.https://developer.android.com/reference/androidx/navigation/NavHost#(androidx.navigation.NavHost).createGraph(kotlin.String,kotlin.String,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavHost receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html startDestination, https://developer.android.com/reference/java/lang/String.html route, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder )` Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph` that supports dynamic navigation destinations |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph` | `https://developer.android.com/reference/androidx/navigation/NavHostKt.https://developer.android.com/reference/androidx/navigation/NavHost#(androidx.navigation.NavHost).createGraph(kotlin.Any,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavHost receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Object.html startDestination, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> route, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-type/index.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavType<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> typeMap, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder )` Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph` |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph` | `https://developer.android.com/reference/androidx/navigation/NavHostKt.https://developer.android.com/reference/androidx/navigation/NavHost#(androidx.navigation.NavHost).createGraph(kotlin.Any,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavHost receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Object.html startDestination, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> route, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-type/index.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavType<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> typeMap, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder )` Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph` that supports dynamic navigation destinations |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph` | `https://developer.android.com/reference/androidx/navigation/NavHostKt.https://developer.android.com/reference/androidx/navigation/NavHost#(androidx.navigation.NavHost).createGraph(kotlin.reflect.KClass,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavHost receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> startDestination, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> route, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-type/index.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavType<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> typeMap, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder )` Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph` |
| `default final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph` | `https://developer.android.com/reference/androidx/navigation/NavHostKt.https://developer.android.com/reference/androidx/navigation/NavHost#(androidx.navigation.NavHost).createGraph(kotlin.reflect.KClass,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavHost receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> startDestination, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> route, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-type/index.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavType<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> typeMap, @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder )` Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph` that supports dynamic navigation destinations |

## Public methods

### getNavController

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
abstract @NonNull NavController getNavController()
```

The `https://developer.android.com/reference/androidx/navigation/NavController` for this navigation host.

## Extension functions

### NavHostKt.createGraph

Artifact: [androidx.navigation:navigation-runtime](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavHost.android.kt+function:createGraph)

```
default final @NonNull NavGraph NavHostKt.[createGraph](https://developer.android.com/reference/androidx/navigation/NavHost#(androidx.navigation.NavHost).createGraph(kotlin.Int,kotlin.Int,kotlin.Function1))(
    @NonNull NavHost receiver,
    @IdRes int id,
    @IdRes int startDestination,
    @NonNull Function1<@NonNull NavGraphBuilder, Unit> builder
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Use routes to create your NavGraph instead, use this instead:
>
> ```
> createGraph(startDestination = startDestination.toString(), route = id.toString()) { builder.invoke() }
> ```

Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph`

### NavHostKt.createGraph

Artifact: [androidx.navigation:navigation-dynamic-features-runtime](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/dynamicfeatures/NavHost.kt+function:createGraph)

```
default final @NonNull NavGraph NavHostKt.[createGraph](https://developer.android.com/reference/androidx/navigation/NavHost#(androidx.navigation.NavHost).createGraph(kotlin.Int,kotlin.Int,kotlin.Function1))(
    @NonNull NavHost receiver,
    @IdRes int id,
    @IdRes int startDestination,
    @NonNull Function1<@NonNull DynamicNavGraphBuilder, Unit> builder
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Use routes to create your dynamic NavGraph instead, use this instead:
>
> ```
> createGraph(startDestination = startDestination.toString(), route = id.toString()) { builder.invoke() }
> ```

Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph` that supports dynamic navigation destinations

### NavHostKt.createGraph

Artifact: [androidx.navigation:navigation-runtime](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavHost.kt+function:createGraph)

```
default final @NonNull NavGraph NavHostKt.createGraph(
    @NonNull NavHost receiver,
    @NonNull String startDestination,
    String route,
    @NonNull Function1<@NonNull NavGraphBuilder, Unit> builder
)
```

Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph`

### NavHostKt.createGraph

Artifact: [androidx.navigation:navigation-dynamic-features-runtime](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/dynamicfeatures/NavHost.kt+function:createGraph)

```
default final @NonNull NavGraph NavHostKt.createGraph(
    @NonNull NavHost receiver,
    @NonNull String startDestination,
    String route,
    @NonNull Function1<@NonNull DynamicNavGraphBuilder, Unit> builder
)
```

Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph` that supports dynamic navigation destinations

### NavHostKt.createGraph

Artifact: [androidx.navigation:navigation-runtime](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavHost.kt+function:createGraph)

```
default final @NonNull NavGraph NavHostKt.createGraph(
    @NonNull NavHost receiver,
    @NonNull Object startDestination,
    KClass<@NonNull ?> route,
    @NonNull Map<@NonNull KType, @NonNull NavType<@NonNull ?>> typeMap,
    @NonNull Function1<@NonNull NavGraphBuilder, Unit> builder
)
```

Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Object.html startDestination` | the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added as a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` in order to match. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> route` | the graph's unique route from a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-type/index.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavType<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> typeMap` | A mapping of KType to custom NavType\<\*\> in the `https://developer.android.com/reference/androidx/navigation/package-summary#(androidx.navigation.NavHost).createGraph(kotlin.Any,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)`. May be empty if `https://developer.android.com/reference/androidx/navigation/package-summary#(androidx.navigation.NavHost).createGraph(kotlin.Any,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)` does not use custom NavTypes. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder` | the builder used to construct the graph |

### NavHostKt.createGraph

Artifact: [androidx.navigation:navigation-dynamic-features-runtime](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/dynamicfeatures/NavHost.kt+function:createGraph)

```
default final @NonNull NavGraph NavHostKt.createGraph(
    @NonNull NavHost receiver,
    @NonNull Object startDestination,
    KClass<@NonNull ?> route,
    @NonNull Map<@NonNull KType, @NonNull NavType<@NonNull ?>> typeMap,
    @NonNull Function1<@NonNull DynamicNavGraphBuilder, Unit> builder
)
```

Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph` that supports dynamic navigation destinations

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Object.html startDestination` | the starting destination's route from an Object for this NavGraph. The respective NavDestination must be added as a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` in order to match. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> route` | the graph's unique route from a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-type/index.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavType<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> typeMap` | A mapping of KType to custom NavType\<\*\> in the `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/package-summary#(androidx.navigation.NavHost).createGraph(kotlin.Any,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)`. May be empty if `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/package-summary#(androidx.navigation.NavHost).createGraph(kotlin.Any,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)` does not use custom NavTypes. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder` | the builder used to construct the graph |

### NavHostKt.createGraph

Artifact: [androidx.navigation:navigation-runtime](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavHost.kt+function:createGraph)

```
default final @NonNull NavGraph NavHostKt.createGraph(
    @NonNull NavHost receiver,
    @NonNull KClass<@NonNull ?> startDestination,
    KClass<@NonNull ?> route,
    @NonNull Map<@NonNull KType, @NonNull NavType<@NonNull ?>> typeMap,
    @NonNull Function1<@NonNull NavGraphBuilder, Unit> builder
)
```

Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> startDestination` | the starting destination's route from a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` for this NavGraph. The respective NavDestination must be added as a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` in order to match. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> route` | the graph's unique route from a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-type/index.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavType<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> typeMap` | A mapping of KType to custom NavType\<\*\> in the `https://developer.android.com/reference/androidx/navigation/package-summary#(androidx.navigation.NavHost).createGraph(kotlin.reflect.KClass,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)`. May be empty if `https://developer.android.com/reference/androidx/navigation/package-summary#(androidx.navigation.NavHost).createGraph(kotlin.reflect.KClass,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)` does not use custom NavTypes. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder` | the builder used to construct the graph |

### NavHostKt.createGraph

Artifact: [androidx.navigation:navigation-dynamic-features-runtime](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/dynamicfeatures/NavHost.kt+function:createGraph)

```
default final @NonNull NavGraph NavHostKt.createGraph(
    @NonNull NavHost receiver,
    @NonNull KClass<@NonNull ?> startDestination,
    KClass<@NonNull ?> route,
    @NonNull Map<@NonNull KType, @NonNull NavType<@NonNull ?>> typeMap,
    @NonNull Function1<@NonNull DynamicNavGraphBuilder, Unit> builder
)
```

Construct a new `https://developer.android.com/reference/androidx/navigation/NavGraph` that supports dynamic navigation destinations

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> startDestination` | the starting destination's route from a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` for this NavGraph. The respective NavDestination must be added as a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` in order to match. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> route` | the graph's unique route from a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-type/index.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavType<@https://developer.android.com/reference/androidx/annotation/NonNull ?>> typeMap` | A mapping of KType to custom NavType\<\*\> in the `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/package-summary#(androidx.navigation.NavHost).createGraph(kotlin.reflect.KClass,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)`. May be empty if `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/package-summary#(androidx.navigation.NavHost).createGraph(kotlin.reflect.KClass,kotlin.reflect.KClass,kotlin.collections.Map,kotlin.Function1)` does not use custom NavTypes. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicNavGraphBuilder, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> builder` | the builder used to construct the graph |