ZNullableBool class

Nullable version of ZBool.

Allows the value to be null, skipping all validation in that case.

Example:

final nullableBool = ZBool().nullable();
final result = nullableBool.parse(true);
Inheritance

Properties

hashCode int
The hash code for this object.
no setterinherited
isNullable bool
Returns true if null is allowed as a valid input.
no setterinherited
isOptional bool
Returns true if the value can be omitted from the input.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onNull(NullFallback<bool> nullFallback) ZBool
Specifies a fallback transformation to apply when the value is null.
optional() ZNullableBool
Enable omitting this value. All rules will be skipped if the value is missing.
parse(Object? val) ZRes<bool?>
Parses val using the configured transformation pipeline and returns a ZRes containing either the successfully parsed value or a validation error.
inherited
process(Processor<bool> processor) ZNullableBool
Adds a custom processing of a value using processor.
refine(Refiner<bool> refiner, {String? message, String? code}) ZNullableBool
Adds a custom refinement to ensure the value satisfies the given refiner.
superRefine(SuperRefiner<bool> refiner) ZNullableBool
Adds a check to ensure that the value satisfies the given refiner.
toStr(Transformer<bool, String> transformer) ZNullableString
Adds a transformation of current bool value to String using custom transformer.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited