NavArgument.Builder
-
Cmn
class NavArgument.Builder
A builder for constructing NavArgument instances.
Summary
Public constructors |
|
|---|---|
Builder() |
Cmn
|
Public functions |
||
|---|---|---|
NavArgument |
build()Build the NavArgument specified by this builder. |
Cmn
|
NavArgument.Builder |
setDefaultValue(defaultValue: Any?)Specify the default value for an argument. |
Cmn
|
NavArgument.Builder |
setIsNullable(isNullable: Boolean)Specify if the argument is nullable. |
Cmn
|
NavArgument.Builder |
Set the type of the argument. |
Cmn
|
Public constructors
Public functions
build
fun build(): NavArgument
Build the NavArgument specified by this builder. If the type is not set, the builder will infer the type from the default argument value. If there is no default value, the type will be unspecified.
| Returns | |
|---|---|
NavArgument |
the newly constructed NavArgument. |
setDefaultValue
fun setDefaultValue(defaultValue: Any?): NavArgument.Builder
Specify the default value for an argument. Calling this at least once will cause the argument to have a default value, even if it is set to null.
| Parameters | |
|---|---|
defaultValue: Any? |
Default value for this argument. Must match NavType if it is specified. |
| Returns | |
|---|---|
NavArgument.Builder |
This builder. |
setIsNullable
fun setIsNullable(isNullable: Boolean): NavArgument.Builder
Specify if the argument is nullable. The NavType you set for this argument must allow nullable values.
| Parameters | |
|---|---|
isNullable: Boolean |
Argument will be nullable if true. |
| Returns | |
|---|---|
NavArgument.Builder |
This builder. |
| See also | |
|---|---|
isNullableAllowed |
setType
fun <T : Any?> setType(type: NavType<T>): NavArgument.Builder
Set the type of the argument.
| Parameters | |
|---|---|
type: NavType<T> |
Type of the argument. |
| Returns | |
|---|---|
NavArgument.Builder |
This builder. |