PhoneNumber class Null safety

represents a phone number

Use one of the static method starting with 'from' in order to return a PhoneNumber that has been parsed to it's international version.

Constructors

PhoneNumber({required String isoCode, required String nsn})
const

Properties

countryCode String
territory numerical code that precedes a phone number. Example 33 for france
read-only
hashCode int
The hash code for this object. [...]
read-only, override
international String
international version of phone number
read-only
isoCode String
country alpha2 code example: 'FR', 'US', ...
final
nsn String
National number in its internanational form
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

getFormattedNsn() String
formats the national phone number to the format expected by the iso code region
isAdjacentTo(PhoneNumber other) bool
We consider the PhoneNumber to be adjacent to the this PhoneNumber if it is one less or one greater than this phone number.
isSequentialTo(PhoneNumber nextNumber) bool
Returns true if nextNumber is the next number (numerically) after this number [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
rebuildWith({String? isoCode, String? nsn}) PhoneNumber
reparse phone number with new values
toString() String
A string representation of this object. [...]
override
validate({PhoneNumberType? type}) bool
validates a phone number by first checking its length then pattern matching
validateLength({PhoneNumberType? type}) bool
validates a phone number by only checking its length

Operators

operator +(int operand) PhoneNumber
numerically add operand to this phone number e.g. [...]
operator -(int operand) PhoneNumber
numerically subtract operand from this phone number e.g. [...]
operator <(PhoneNumber rhs) bool
Returns true if this phone number is numerically less than other
operator <=(PhoneNumber rhs) bool
Returns true if this phone number is numerically less than or equal to other
operator ==(Object other) bool
The equality operator. [...]
override
operator >(PhoneNumber other) bool
Returns true if this phone number is numerically greater than other
operator >=(PhoneNumber other) bool
Returns true if this phone number is numerically greater than or equal to other

Static Methods

findPotentialPhoneNumbers(String text) Iterable<Match>
fromCountryCode(String countryCode, String phoneNumber) PhoneNumber
Parses a phoneNumber given a countryCode [...]
fromIsoCode(String isoCode, String phoneNumber) PhoneNumber
Parses a phoneNumber given an isoCode [...]
fromNational(String countryCode, String national) PhoneNumber
Parses a national phone number given a country code and returns a PhoneNumber [...]
fromRaw(String phoneNumber) PhoneNumber
Parses a phoneNumber given a countryCode [...]
getRange(PhoneNumber start, PhoneNumber end) PhoneNumberRange