isValidPhone property

bool get isValidPhone

Checks if the string is a valid phone number in a specific format.

Accepts numbers with optional + and requires exactly 11 digits starting with 0.

Example:

'01234567890'.isValidPhone; // true

Implementation

bool get isValidPhone {
  final phoneRegExp = RegExp(r'^\+?0[0-9]{10}$');
  return phoneRegExp.hasMatch(this);
}