PhoneNumber class

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 IsoCode isoCode, required String nsn})
const
PhoneNumber.fromJson(String source)
factory
PhoneNumber.fromMap(Map<String, dynamic> map)
factory

Properties

countryCode String
territory numerical code that precedes a phone number. Example 33 for france
no setter
hashCode int
The hash code for this object.
no setteroverride
international String
international version of phone number
no setter
isoCode IsoCode
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.
no setterinherited

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 nonexistent method or property is accessed.
inherited
rebuildWith({IsoCode? isoCode, String? nsn}) PhoneNumber
reparse phone number with new values
toJson() String
toMap() Map<String, dynamic>
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 (ex: '33')
fromIsoCode(IsoCode isoCode, String phoneNumber) PhoneNumber
Parses a phoneNumber given an isoCode
fromNational(IsoCode isoCode, 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