ShortNumberInfo class

Methods for getting information about short phone numbers, such as short codes and emergency numbers. Note that most commercial short numbers are not handled here, but by the PhoneNumberUtil.

Constructors

ShortNumberInfo(MetadataMapLoader _metadataMapLoader)

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

connectsToEmergencyNumber(String number, String regionCode) bool
Returns true if the given number, exactly as dialed, might be used to connect to an emergency service in the given region.
getExampleShortNumber(String? regionCode) String
Gets a valid short number for the specified region.
getExampleShortNumberForCost(String regionCode, ShortNumberCost cost) String
Gets a valid short number for the specified cost category.
getExpectedCost(PhoneNumber number) ShortNumberCost
Gets the expected cost category of a short number (however, nothing is implied about its validity). If the country calling code is unique to a region, this method behaves exactly the same as getExpectedCostForRegion(PhoneNumber, String). However, if the country calling code is shared by multiple regions, then it returns the highest cost in the sequence ShortNumberCost.premiumRate, ShortNumberCost.unknownCost, ShortNumberCost.standardRate, ShortNumberCost.tollFree. The reason for the position of unknownCost in this order is that if a number is unknownCost in one region but standardRate or tollFree in another, its expected cost cannot be estimated as one of the latter since it might be a premiumRate number.
getExpectedCostForRegion(PhoneNumber number, String regionDialingFrom) ShortNumberCost
Gets the expected cost category of a short number when dialed from a region (however, nothing is implied about its validity). If it is important that the number is valid, then its validity must first be checked using isValidShortNumberForRegion. Note that emergency numbers are always considered toll-free. Example usage:
isCarrierSpecific(PhoneNumber number) bool
Given a valid short number, determines whether it is carrier-specific (however, nothing is implied about its validity). Carrier-specific numbers may connect to a different end-point, or not connect at all, depending on the user's carrier. If it is important that the number is valid, then its validity must first be checked using isValidShortNumber or isValidShortNumberForRegion.
isCarrierSpecificForRegion(PhoneNumber number, String regionDialingFrom) bool
Given a valid short number, determines whether it is carrier-specific when dialed from the given region (however, nothing is implied about its validity). Carrier-specific numbers may connect to a different end-point, or not connect at all, depending on the user's carrier. If it is important that the number is valid, then its validity must first be checked using isValidShortNumber or isValidShortNumberForRegion. Returns false if the number doesn't match the region provided.
isEmergencyNumber(String number, String regionCode) bool
Returns true if the given number exactly matches an emergency service number in the given region.
isPossibleShortNumber(PhoneNumber number) bool
Check whether a short number is a possible number. If a country calling code is shared by multiple regions, this returns true if it's possible in any of them. This provides a more lenient check than isValidShortNumber. See isPossibleShortNumberForRegion(PhoneNumber, String) for details.
isPossibleShortNumberForRegion(PhoneNumber number, String regionDialingFrom) bool
Check whether a short number is a possible number when dialed from the given region. This provides a more lenient check than isValidShortNumberForRegion.
isSmsServiceForRegion(PhoneNumber number, String regionDialingFrom) bool
Given a valid short number, determines whether it is an SMS service (however, nothing is implied about its validity). An SMS service is where the primary or only intended usage is to receive and/or send text messages (SMSs). This includes MMS as MMS numbers downgrade to SMS if the other party isn't MMS-capable. If it is important that the number is valid, then its validity must first be checked using isValidShortNumber or isValidShortNumberForRegion. Returns false if the number doesn't match the region provided.
isValidShortNumber(PhoneNumber number) bool
Tests whether a short number matches a valid pattern. If a country calling code is shared by multiple regions, this returns true if it's valid in any of them. Note that this doesn't verify the number is actually in use, which is impossible to tell by just looking at the number itself. See isValidShortNumberForRegion(PhoneNumber, String) for details.
isValidShortNumberForRegion(PhoneNumber number, String? regionDialingFrom) bool
Tests whether a short number matches a valid pattern in a region. Note that this doesn't verify the number is actually in use, which is impossible to tell by just looking at the number itself.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance ShortNumberInfo
Returns the singleton instance of the ShortNumberInfo.
no setter