NavArgument
public final class NavArgument
NavArgument denotes an argument that is supported by a 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 |
|---|
public final class NavArgument.BuilderA builder for constructing |
Public methods |
|
|---|---|
boolean |
|
final Object |
The default value of this argument or |
final @NonNull NavType<Object> |
getType()The type of this NavArgument. |
int |
hashCode() |
final boolean |
Used to distinguish between a default value of |
final boolean |
Whether this argument allows passing a |
@NonNull String |
toString() |
Public methods
getDefaultValue
public final Object getDefaultValue()
The default value of this argument or null if it doesn't have a default value. Use isDefaultValuePresent to distinguish between null and absence of a value.
| Returns | |
|---|---|
Object |
The default value assigned to this argument. |
getType
public final @NonNull NavType<Object> getType()
The type of this NavArgument.
isDefaultValuePresent
public final boolean isDefaultValuePresent()
Used to distinguish between a default value of null and an argument without an explicit default value.
| Returns | |
|---|---|
boolean |
true if this argument has a default value (even if that value is set to null), false otherwise |
isNullable
public final boolean isNullable()
Whether this argument allows passing a null value.
| Returns | |
|---|---|
boolean |
true if |