fromMap static method

CountryInfo? fromMap(
  1. Map<String, dynamic>? _map
)
override

Construct from Map.

Implementation

static CountryInfo? fromMap(Map<String, dynamic>? _map) {
  if (_map == null) return null;
  var _ = _map["@type"];
  if (_ != CONSTRUCTOR) return null;
  var extra = _map['@extra'];
  var clientId = _map['@clientId'];
  var country_code = _map['country_code']! as String;
  var name = _map['name']! as String;
  var english_name = _map['english_name']! as String;
  var is_hidden = _map['is_hidden']! as bool;
  var calling_codes = List<String>.from(
    (_map["calling_codes"] ?? []).map(
      (e) => e as String,
    ),
  );
  return CountryInfo(
    extra: extra,
    clientId: clientId,
    country_code: country_code,
    name: name,
    english_name: english_name,
    is_hidden: is_hidden,
    calling_codes: calling_codes,
  );
}