FlutterLibphonenumber class

Constructors

FlutterLibphonenumber()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

format(String phone, String region) Future<Map<String, String>>
Formats a phone number using platform libphonenumber. Will return the parsed number.
formatNumberSync(String number, {CountryWithPhoneCode? country, PhoneNumberType phoneNumberType = PhoneNumberType.mobile, PhoneNumberFormat phoneNumberFormat = PhoneNumberFormat.international, bool removeCountryCodeFromResult = false, bool inputContainsCountryCode = true}) String
Given a phone number, format it automatically using the masks we have from libphonenumber's example numbers. Optionally override the country (instead of auto-detecting), the number type, format.
getAllSupportedRegions() Future<Map<String, CountryWithPhoneCode>>
Return all available regions with their country code, phone code, and formatted example number as a mask. Useful to later format phone numbers using a mask.
getFormattedParseResult(String phoneNumber, CountryWithPhoneCode country, {PhoneNumberType phoneNumberType = PhoneNumberType.mobile, PhoneNumberFormat phoneNumberFormat = PhoneNumberFormat.international}) Future<FormatPhoneResult?>
Asynchronously formats a number, returning the e164 and the number's requested format result by specifying a PhoneNumberType and PhoneNumberFormat.
init({Map<String, CountryWithPhoneCode> overrides = const {}}) Future<void>
Must call this before anything else so the countries data is populated.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(String phone, {String? region}) Future<Map<String, dynamic>>
Parse a single string and return a map in the format below. Throws an error if the number is not a valid e164 phone number.
toString() String
A string representation of this object.
inherited

Operators

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