startsWithPlusAndContainsOnlyNumbers property
bool
get
startsWithPlusAndContainsOnlyNumbers
Returns true if this string starts with a plus sign and contains only numeric digits after it.
This is commonly used for validating international phone number formats.
Example:
'+123456789'.startsWithPlusAndContainsOnlyNumbers; // returns: true
'123456789'.startsWithPlusAndContainsOnlyNumbers; // returns: false
Implementation
bool get startsWithPlusAndContainsOnlyNumbers {
return regexStartsWithPlusAndThenOnlyNumbers.hasMatch(this);
}