onValidate method
override
onValidate is used to validate the given input by the user.
Implementation
@override
String? onValidate(
String? value,
String Function(String, {List<String>? params}) translator,
) {
if (mandatory) {
if (value == null || value.isEmpty) {
return translator('shell.form.error.empty');
}
if (!RegExp(
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+",
).hasMatch(value)) {
return translator('shell.form.error.email.notValid');
}
}
return null;
}