PhoneCountryData.fromMap constructor

PhoneCountryData.fromMap(
  1. Map value, {
  2. String lang = '',
})

Implementation

factory PhoneCountryData.fromMap(
  Map value, {
  String lang = '',
}) {
  final countryData = PhoneCountryData._init(
    country: value['country$lang'],

    /// not all countryDatas need to separate phoneCode and
    /// internalPhoneCode. In most cases they are the same
    /// so we only need to check if the field is present and set
    /// the dafult one if not
    phoneCode: value['phoneCode'] ?? value['internalPhoneCode'],
    internalPhoneCode: value['internalPhoneCode'],
    countryCode: value['countryCode'],
    phoneMask: value['phoneMask'],
    altMasks: value['altMasks'],
  );
  return countryData;
}