PhoneFormatter class

Utility class for formatting and validating phone numbers.

All formatting is driven by the PhoneFormatSpec.pattern stored in CountryModel. The pattern uses # as a digit placeholder; every other character (space, dash, parenthesis, etc.) is inserted verbatim.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

applyPattern(String digits, String pattern) String
Applies pattern to digits (digits-only string).
format(String number, CountryModel country) String
Formats number (digits only or partially typed) according to the national pattern defined for country.
getUnformatted(String formatted) String
Strips all non-digit characters from formatted.
validate(String number, CountryModel country) String?
Validates number against country length constraints.