getExampleShortNumber method

  1. @visibleForTesting
String getExampleShortNumber(
  1. String? regionCode
)

Gets a valid short number for the specified region.

regionCode the region for which an example short number is needed returns a valid short number for the specified region. Returns an empty string when the metadata does not contain such information.

Implementation

@visibleForTesting
String getExampleShortNumber(String? regionCode) {
  PhoneMetadata? phoneMetadata = _getShortNumberMetadataForRegion(regionCode);
  if (phoneMetadata == null) {
    return "";
  }

  PhoneNumberDesc desc = phoneMetadata.shortCode;
  if (desc.hasExampleNumber()) {
    return desc.exampleNumber;
  }

  return "";
}