lookupCountryIdentifier method

String? lookupCountryIdentifier(
  1. String productCode
)

Implementation

String? lookupCountryIdentifier(String productCode) {
  initIfNeeded();
  final prefix = int.parse(productCode.substring(0, 3));
  final max = ranges.length;
  for (int i = 0; i < max; i++) {
    final range = ranges[i];
    final start = range[0];
    if (prefix < start) {
      return null;
    }
    final end = range.length == 1 ? start : range[1];
    if (prefix <= end) {
      return countryIdentifiers[i];
    }
  }
  return null;
}