Builder
class Builder
kotlin.Any | |
↳ | androidx.navigation.NavArgument.Builder |
A builder for constructing NavArgument
instances.
Summary
Public constructors | |
---|---|
<init>() A builder for constructing |
Public methods | |
---|---|
NavArgument |
build() Build the NavArgument specified by this builder. |
NavArgument.Builder |
setDefaultValue(@Nullable : Any?) Specify the default value for an argument. |
NavArgument.Builder |
Specify if the argument is nullable. |
NavArgument.Builder |
Set the type of the argument. |
Public constructors
Public methods
build
@NonNull 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.
Return | |
---|---|
NavArgument |
the newly constructed NavArgument. |
setDefaultValue
@NonNull fun setDefaultValue(@Nullable : 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. |
Return | |
---|---|
NavArgument.Builder |
This builder. |
setIsNullable
@NonNull fun setIsNullable(: 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. |
Return | |
---|---|
NavArgument.Builder |
This builder. |
See Also
setType
@NonNull fun setType(@NonNull : NavType<*>): NavArgument.Builder
Set the type of the argument.
Parameters | |
---|---|
type |
NavType<*>: Type of the argument. |
Return | |
---|---|
NavArgument.Builder |
This builder. |