PhoneNumber class
represents a phone number
Use PhoneNumber.parse to compute a phone number. Use PhoneNumber if you know the phone number nsn and iso code you can use the default constructor, this won't run any computation.
Constructors
- PhoneNumber({required IsoCode isoCode, required String nsn})
-
const
-
PhoneNumber.fromJson(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 international form
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
formatNsn(
{IsoCode? isoCode, NsnFormat format = NsnFormat.national}) → String -
formats the nsn, if no
isoCode
is provided the phone number region is used. -
getFormattedNsn(
{IsoCode? isoCode}) → String -
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 -
isValid(
{PhoneNumberType? type}) → bool - validates a phone number by first checking its length then pattern matching
-
isValidLength(
{PhoneNumberType? type}) → bool - validates a phone number by only checking its length
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
override
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< PhoneNumber> -
getRange(
PhoneNumber start, PhoneNumber end) → PhoneNumberRange -
parse(
String phoneNumber, {IsoCode? callerCountry, IsoCode? destinationCountry}) → PhoneNumber - Parses a phone number given caller or destination information.