BCPhoneNumber class

A phone number as a country plus a national significant number.

The nsn is always in its international form: digits only, no trunk prefix (a UK number is 7400123456, not 07400123456) and no dial code.

Annotations

Constructors

BCPhoneNumber({required IsoCode isoCode, required String nsn})
const
BCPhoneNumber.parse(String text, {IsoCode? country})
Reads a number in any shape — +8801712345678, or 01712-345678 with country set — and never throws: an unreadable string comes back as the digits it could salvage, under country (or IsoCode.US when none was given).
factory

Properties

dialCode String
Dial code without the plus — 880 for Bangladesh.
no setter
e164 String
+8801712345678. Empty while nsn is.
no setter
hashCode int
The hash code for this object.
no setteroverride
international String
+880 1712-345678.
no setter
isEmpty bool
no setter
isoCode IsoCode
The country this number belongs to.
final
isValid bool
Length and pattern, checked against libPhoneNumber's metadata — so +1 555 000 0000 comes back false where a digit-count check would not.
no setter
national String
Grouped the way the country writes it — (201) 555-0123. Falls back to bare digits for a number too incomplete to group.
no setter
nsn String
National significant number — digits only.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({IsoCode? isoCode, String? nsn}) BCPhoneNumber
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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