validators library

Functions

all(List<IEskValidator> validators) IEskValidator
Passes the test if all of the EskValidators are valid, and fails if any of them are invalid
any(List<IEskValidator> validators) IEskValidator
/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// Passes the test if any of the EskValidators are valid, and fails if any are invalid
contains<T>(T item) IEskValidator
Checks whether the given value contains the item value of type T
eskema(Map<String, IEskValidator> eskema) IEskValidator
/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// Returns a Validator that checks a value against a Map eskema that declares a validator for each key.
eskemaList(List<IEskValidator> eskema) IEskValidator
Returns a Validator that checks a value against the eskema provided, the eskema defines a validator for each item in the list
isBool() IEskValidator
Returns a IEskValidator that checks if the given value is a bool For better performance and readability, use the $isBool variable directly.
isDate() IEskValidator
Checks whether the given value is a valid DateTime formatted String
isDeepEq<T>(T otherValue) IEskValidator
Checks whether the given value is equal to the otherValue value of type T
isDouble() IEskValidator
Returns a IEskValidator that checks if the given value is a double For better performance and readability, use the $isDouble variable directly.
isEmpty() IEskValidator
isEnum() IEskValidator
Returns a IEskValidator that checks if the given value is a Enum For better performance and readability, use the $isEnum variable directly.
isEq<T>(T otherValue) IEskValidator
Checks whether the given value is equal to the otherValue value of type T
isFunction() IEskValidator
Returns a IEskValidator that checks if the given value is a Function For better performance and readability, use the $isFunction variable directly.
isFuture<T>() IEskValidator
Returns a IEskValidator that checks if the given value is a Future For better performance and readability, use the $isFuture variable directly.
isGt(num min) IEskValidator
Checks whether the given value is greater than max
isGte(num min) IEskValidator
Checks whether the given value is greater or equal to max
isInt() IEskValidator
Returns a IEskValidator that checks if the given value is a int For better performance and readability, use the $isInt variable directly.
isIterable<T>() IEskValidator
Returns a IEskValidator that checks if the given value is a Iterable For better performance and readability, use the $isIterable variable directly.
isList<T>() IEskValidator
Returns a IEskValidator that checks if the given value is a List For better performance and readability, use the $isList variable directly.
isLt(num max) IEskValidator
/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// Checks whether the given value is less than max
isLte(num max) IEskValidator
Checks whether the given value is less than or equal max
isMap<K, V>() IEskValidator
Returns a IEskValidator that checks if the given value is a Map For better performance and readability, use the $isMap variable directly.
isNotEmpty() IEskValidator
Checks whether the given value is not empty
isNull() IEskValidator
Returns a IEskValidator that checks if the given value is null For better performance and readability, use the $isNull variable directly.
isNumber() IEskValidator
Returns a IEskValidator that checks if the given value is a num For better performance and readability, use the $isNumber variable directly.
isOneOf<T>(List<T> options) IEskValidator
Checks whether the given value is one of the options values of type T
isRecord() IEskValidator
Returns a IEskValidator that checks if the given value is a Record
isSet<T>() IEskValidator
Returns a IEskValidator that checks if the given value is a Set For better performance and readability, use the $isSet variable directly.
isString() IEskValidator
Returns a IEskValidator that checks if the given value is a String For better performance and readability, use the $isString variable directly.
isSymbol() IEskValidator
Returns a IEskValidator that checks if the given value is a Symbol For better performance and readability, use the $isSymbol variable directly.
isType<T>() IEskValidator
/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// Returns a EskValidator that checks if the given value is the correct type
isTypeOrNull<T>() IEskValidator
Returns a EskValidator that checks if the given value is the correct type
length(List<IEskValidator> validators) IEskValidator
Checks whether the given value has a length property and the length matches the validators
listContains<T>(dynamic item) IEskValidator
Validates that the List contains item
listEach(IEskValidator itemValidator) IEskValidator
Returns a Validator that runs itemValidator for each item in the list
listEmpty<T>() IEskValidator
Validate that the list is empty
listIsOfLength(int size) IEskValidator
Validates that it's a list of size length
listLength<T>(List<IEskValidator> validators) IEskValidator
/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// Validates that it's a List and the length matches the validators
none(List<IEskValidator> validators) IEskValidator
Passes the test if none of the validators pass
not(IEskValidator validator) IEskValidator
Passes the test if the passed in validator is not valid
nullable(IEskValidator validator) IEskValidator
Allows the passed in validator to be nullable
stringContains(String str) IEskValidator
Validates that the String contains str
stringEmpty<T>() IEskValidator
Validate that the string is empty
stringIsOfLength(int size) IEskValidator
Validates that the String's length is the same as the provided size
stringLength(List<IEskValidator> validators) IEskValidator
/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// Validates that the String's length matches the validators
stringMatchesPattern(Pattern pattern, {String? error}) IEskValidator
Validates that the String matches the provided pattern
throwInstead(IEskValidator validator) IEskValidator
Returns a EskValidator that throws a ValidatorFailedException instead of returning a result
validator(dynamic comparisonFn(dynamic value), dynamic errorFn(dynamic value)) EskValidator