EskValidator class

An implementation of IEskValidator, which accepts a validator function, which is used by the EskValidator to validate some data.

Take a look at validators for examples.

Inheritance
Implementers
Available extensions

Constructors

EskValidator(EskValidatorFn _validator, {bool nullable = false})

Properties

hashCode int
The hash code for this object.
no setterinherited
isNullable bool
Whether the validator accepts null values. If isNullable is true, and the value being checked is null, the validation is considered valid.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({bool? nullable}) IEskValidator
Creates a copy of the validator with the given parameters.
override
isNotValid(dynamic value) bool
Checks if the given value is not valid.
inherited
isValid(dynamic value) bool
Checks if the given value is valid.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nullable<T>() IEskValidator
Creates a nullable copy of the validator.
inherited
toString() String
A string representation of this object.
override
validate(dynamic value) EskResult
Main validation method. Use this method if you want to validate that a dynamic value is valid, and get an error message if not.
inherited
validateOrThrow(dynamic value) EskResult
Works the same as validate, validates that a given value is valid, but throws instead if it's not.
inherited
validator(dynamic value) EskResult
Validates the given value and returns the result.
override

Operators

operator &(IEskValidator other) IEskValidator

Available on IEskValidator, provided by the EskemaEskValidatorOperations extension

Combines two validators with a logical AND, same as using all
operator ==(Object other) bool
The equality operator.
inherited
operator >(String error) IEskValidator

Available on IEskValidator, provided by the EskemaEskValidatorOperations extension

Returns a new validator that will return the error message if the validation fails
operator |(IEskValidator other) IEskValidator

Available on IEskValidator, provided by the EskemaEskValidatorOperations extension

Combines two validators with a logical OR, same as using any