phone static method
Validates E.164 phone number format (e.g. +2348012345678).
Implementation
static String? phone(String? value) {
if (value == null || value.trim().isEmpty) {
return 'Phone number is required.';
}
final regex = RegExp(r'^\+[1-9]\d{6,14}$');
if (!regex.hasMatch(value.trim())) {
return 'Enter a valid phone number with country code (e.g. +2348012345678).';
}
return null;
}