validate static method

String? validate(
  1. String? phone
)

Implementation

static String? validate(String? phone) {
  if (phone == null || phone.trim().isEmpty) {
    return 'Phone number is required';
  }
  if (!_phoneRegex.hasMatch(phone.trim())) {
    return 'Enter a valid phone number (e.g. +1234567890)';
  }
  return null;
}