fromJson static method

IsoCode fromJson(
  1. String isoCodeStr
)

Returns the IsoCode for isoCodeStr, the form written by toJson.

Throws a PhoneNumberException with Code.invalidIsoCode when isoCodeStr is not an ISO code this library knows about.

Implementation

static IsoCode fromJson(String isoCodeStr) {
  final isoCode = isoCodeConversionMap[isoCodeStr];
  if (isoCode == null) {
    throw PhoneNumberException(
      code: Code.invalidIsoCode,
      description: "not a known ISO code, found '$isoCodeStr'",
    );
  }
  return isoCode;
}