VPrimitive<T> class
abstract
A validation class that supports any
and every
conditions.
Extends VRefine to allow chaining multiple validation rules where:
any
: The value must satisfy at least one of the given validation rules.every
: The value must satisfy all of the given validation rules.
This class provides flexible validation options for complex scenarios.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isNullable → bool
-
Indicates whether the value can be
null
.no setterinherited - isOptional → bool
-
Indicates whether the value is optional.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
validators
→ List<
Validator< T> > -
Returns the list of validators added to this type.
no setterinherited
Methods
-
add(
Validator< T> validator) → VType<T> -
Adds a validator to the current type.
inherited
-
any(
List< VType< types, {String? message}) → VType<T> >T> - Ensures that the value satisfies at least one of the given validators.
-
array(
{String? message}) → VArray< T> -
Converts the current validator into an array validator (
VArray<T>
). -
every(
List< VType< types, {String? message}) → VType<T> >T> - Ensures that the value satisfies all the given validators.
-
getErrorMessage(
T? value) → dynamic -
Retrieves the validation error message for a given value.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
nullable(
) → VType< T> -
Marks the value as nullable, allowing
null
as a valid input.inherited -
optional(
) → VType< T> -
Marks the value as optional, meaning it can be omitted without causing validation failure.
inherited
-
refine(
bool validator(T data), {String? message}) → VRefine< T> -
Applies a custom validation rule using a refine function.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
T? value) → bool -
Validates the provided value based on the assigned validation rules.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited