phone static method

String? phone(
  1. String? value
)

Implementation

static String? phone(String? value) {
  if (value == null || value.trim().isEmpty)
    return 'Phone number is required';
  final phoneRegex = RegExp(r'^[0-9]{10}\$');
  if (!phoneRegex.hasMatch(value))
    return 'Enter a valid 10-digit phone number';
  return null;
}