isValid function
Implementation
bool isValid(String value, {int minLength = 0, RegExp? regex}) {
if (value.isEmpty || value.length < minLength) {
return false;
}
if (regex != null && !regex.hasMatch(value)) {
return false;
}
return true;
}