isValid static method

bool isValid(
  1. String? value, {
  2. int minLength = 6,
  3. int maxLength = 20,
  4. RegExp? pattern,
})

Implementation

static bool isValid(
  String? value, {
  int minLength = 6,
  int maxLength = 20,
  RegExp? pattern,
}) {
  bool a = value != null && value.isNotEmpty && value.toLowerCase() != "null";
  bool b = maxLength <= 0 ? a : a && value.length <= maxLength;
  bool c = b && value.length >= minLength;
  bool d = pattern != null ? pattern.hasMatch(value ?? '') : c;
  return d;
}