required static method

Validator required([
  1. bool strict = false
])

Implementation

static Validator required([bool strict = false]) {
  return (String? value) {
    if ((value?.isEmpty ?? true)) {
      return "Field cannot be empty.";
    } else if (strict && !(value?.containNameChars() ?? true)) {
      return "Invalid character(s) found.";
    }
    return null;
  };
}