AcanthisNullable<T> class

A class to validate nullable types

Inheritance

Constructors

AcanthisNullable(AcanthisType<T> element, {T? defaultValue, List<AcanthisOperation<T?>> operations = const [], bool isAsync = false, String key = '', MetadataEntry<T?>? metadataEntry})
const

Properties

defaultValue → T?
finalinherited
element AcanthisType<T>
The element of the nullable
final
elementType Type
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isAsync bool
A boolean that indicates if the type is async or not
finalinherited
key String
A string that indicates the key of the type
finalinherited
metadataEntry MetadataEntry<T?>?
finalinherited
operations UnmodifiableListView<AcanthisOperation<T?>>
The operations that the type should perform
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

and(List<AcanthisType> elements) AcanthisTuple
Make the type a tuple
inherited
enumerated(List<T?> values, {String? message, String messageBuilder(List<T?> value)?}) AcanthisNullable<T>
Check if the value is part of the enumerated values
list() AcanthisList<T?>
Make the type a list of the type
inherited
meta(MetadataEntry<T?> metadata) AcanthisType<T?>
Add a metadata to the type
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nullable({T? defaultValue}) AcanthisNullable
Make the type nullable
override
or<T>(List elements) AcanthisUnion<T>
Make the type a union
inherited
parse(T? value) AcanthisParseResult<T?>
override of the parse method from AcanthisType
override
parseAsync(T? value) Future<AcanthisParseResult<T?>>
The parseAsync method to parse the value that uses AcanthisAsyncCheck it returns a AcanthisParseResult with the parsed value and throws a ValidationError if the value is not valid
override
pipe<T>(AcanthisType<T> type, {required T transform(T? value), T? defaultValue}) AcanthisPipeline<T?, T>
Add a pipe transformation to the type to transform the value to another type
inherited
refine({required bool onCheck(T? value), required String error, required String name}) AcanthisType<T?>
Add a custom check to the number
inherited
refineAsync({required Future<bool> onCheck(T? value), required String error, required String name}) AcanthisType<T?>
Add a custom async check to the number
inherited
toJsonSchema() Map<String, dynamic>
Convert the type to a JSON schema
override
toOpenApiSchema() Map<String, dynamic>
override
toPrettyJsonSchema({int indent = 2}) String
Convert the type to a JSON schema and format it with indent spaces
inherited
toString() String
A string representation of this object.
inherited
transform(T? transformation(T? value)) AcanthisType<T?>
Add a typed transformation to the type. It does not transform the value if the type is not the same
inherited
tryParse(T? value) AcanthisParseResult<T?>
override of the tryParse method from AcanthisType
override
tryParseAsync(T? value) Future<AcanthisParseResult<T?>>
The tryParseAsync method to try to parse the value that uses AcanthisAsyncCheck it returns a AcanthisParseResult that has the following properties:
override
withAsyncCheck(AcanthisAsyncCheck<T?> check) AcanthisNullable<T>
Add an async check to the type
override
withCheck(AcanthisCheck<T?> check) AcanthisNullable<T>
Add a check to the type
override
withDefault(T? value) AcanthisType<T?>
override
withTransformation(AcanthisTransformation<T?> transformation) AcanthisNullable<T>
Add a transformation to the type
override

Operators

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