isPhone property

bool get isPhone

Checks if the string matches a valid phone number pattern.

Implementation

bool get isPhone {
  final phonePattern = RegExp(r'^\+?[0-9\s\-()]{7,20}$');
  return phonePattern.hasMatch(trim());
}