date static method
Date validator (YYYY-MM-DD).
Implementation
static String? date(String? string, {String? errorMessage}) {
final dateRegExp = RegExp(r'^\d{4}-\d{2}-\d{2}$');
if (string == null || string.isEmpty || dateRegExp.hasMatch(string)) {
return null;
}
return errorMessage ?? FieldBlocValidatorsErrors.date;
}