PhoneNumber class
Represents a phone number with country code information.
PhoneNumber combines a country (with dial code) and a phone number string to create a complete international phone number.
Example:
final phone = PhoneNumber(
Country(dialCode: '+1', code: 'US'),
'5551234567',
);
print(phone.fullNumber); // +15551234567
Constructors
- PhoneNumber(Country? country, String number)
-
Creates a PhoneNumber with the specified country and number.
const
Properties
- country → Country?
-
The country associated with this phone number.
final
- fullCodeNumber → String
-
Gets the complete phone number with a plus sign prefix.
no setter
- fullNumber → String
-
Gets the complete phone number including country code.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- number → String
-
The phone number without the country code.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → String?
-
Gets the full number or null if the number is empty.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
withCountry(
Country? country) → PhoneNumber - Creates a copy with a new country
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override