isValidPhoneNumber static method

bool isValidPhoneNumber(
  1. String phone
)

Validate phone number format (E.164).

Checks if the phone number follows E.164 international format (+country code). Supports country codes from 1 to 3 digits and phone numbers up to 14 digits.

Parameters

  • phone: The phone number to validate (e.g., '+254712345678')

Returns

true if the phone number format is valid, false otherwise.

Implementation

static bool isValidPhoneNumber(String phone) {
  return _phoneRegex.hasMatch(phone);
}