validate method

Result validate(
  1. IValidator eskema
)

Returns a Validator that checks a value against the eskema provided, the eskema defines a validator for each item in the list

Example:

final isValidList = eskemaList([isType<String>(), isType<int>()]);
isValidList(["1", 2]).isValid;   // true
isValidList(["1", "2"]).isValid; // false
isValidList([1, "2"]).isValid;   // false

isValidList will only be valid:

  • if the array is of length 2
  • the first item is a string
  • and the second item is an int

This validator also checks that the value is a list

Implementation

Result validate(IValidator eskema) {
  return listEach(eskema).validate(this);
}