# NavArgument

# NavArgument

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/navigation/NavArgument "View this page in Java")
Common/AllAndroid/JVM
  - Cmn  

  ```
  class NavArgument
  ```

*** ** * ** ***

NavArgument denotes an argument that is supported by a[NavDestination](https://developer.android.com/reference/kotlin/androidx/navigation/NavDestination).

A NavArgument has a type and optionally a default value, that are used to read/write it in a SavedState. It can also be nullable if the type supports it.

## Summary

|                                                                                                                    ### Nested types                                                                                                                     |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[NavArgument.Builder](https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument.Builder) A builder for constructing[NavArgument](https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument)instances. |

|                                        ### Public functions                                         |
|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` | Cmn |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | [hashCode](https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument#hashCode())`()`                                                                                            | Cmn |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)            | [toString](https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument#toString())`()`                                                                                            | Cmn |

|                                                                          ### Public properties                                                                          |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?`                                                                                          | [defaultValue](https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument#defaultValue()) The default value of this argument or`null`if it doesn't have a default value.                                           | Cmn |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                     | [isDefaultValuePresent](https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument#isDefaultValuePresent()) Used to distinguish between a default value of`null`and an argument without an explicit default value. | Cmn |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                     | [isNullable](https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument#isNullable()) Whether this argument allows passing a`null`value.                                                                           | Cmn |
| [NavType](https://developer.android.com/reference/kotlin/androidx/navigation/NavType)`<`[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?>` | [type](https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument#type()) The type of this NavArgument.                                                                                                            | Cmn |

## Public functions

### equals

Cmn  

```
open operator fun equals(other: Any?): Boolean
```  

### hashCode

Cmn  

```
open fun hashCode(): Int
```  

### toString

Cmn  

```
open fun toString(): String
```

## Public properties

### defaultValue

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

```
val defaultValue: Any?
```

The default value of this argument or`null`if it doesn't have a default value. Use[isDefaultValuePresent](https://developer.android.com/reference/kotlin/androidx/navigation/NavArgument#isDefaultValuePresent())to distinguish between`null`and absence of a value.  

|                                    Returns                                     |
|--------------------------------------------------------------------------------|----------------------------------------------|
| [Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?` | The default value assigned to this argument. |

### isDefaultValuePresent

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

```
val isDefaultValuePresent: Boolean
```

Used to distinguish between a default value of`null`and an argument without an explicit default value.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if this argument has a default value (even if that value is set to null), false otherwise |

### isNullable

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

```
val isNullable: Boolean
```

Whether this argument allows passing a`null`value.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if`null`is allowed, false otherwise |

### type

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

```
val type: NavType<Any?>
```

The type of this NavArgument.  

|                                                                                 Returns                                                                                 |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [NavType](https://developer.android.com/reference/kotlin/androidx/navigation/NavType)`<`[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?>` | the NavType object denoting the type that can be help in this argument. |