ZNullableEnum<T extends Enum> class

Nullable version of ZEnum.

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

Example:

enum Color { red, green, blue }

final simpleEnumSchema = ZEnum.simple(enumValues: Color.values).nullable();
final result = simpleEnumSchema.parse('red');
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<T> nullFallback) ZEnum<T>
Specifies a fallback transformation to apply when the value is null.
optional() ZNullableEnum<T>
Enable omitting this value. All rules will be skipped if the value is missing.
parse(Object? val) ZRes<T?>
Parses val using the configured transformation pipeline and returns a ZRes containing either the successfully parsed value or a validation error.
inherited
process(Processor<T> processor) ZNullableEnum<T>
Adds a custom processing of a value using processor.
refine(Refiner<T> refiner, {String? message, String? code}) ZNullableEnum<T>
Adds a custom refinement to ensure the value satisfies the given refiner.
superRefine(SuperRefiner<T> refiner) ZNullableEnum<T>
Adds a check to ensure that the value satisfies the given refiner.
toString() String
A string representation of this object.
inherited

Operators

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