validate method
- String? value
override
Validates the value and returns an error string if it fails,
or null if it passes.
Implementation
@override
String? validate(String? value) {
if (value == null || value.isEmpty) return null;
// Standard ITU-T E.164 country code: starts with '+', then 1 to 3 (or 4) digits.
if (!RegExp(r'^\+[1-9]\d{0,3}$').hasMatch(value)) {
return message;
}
return null;
}