fromJson static method

CountryInfo? fromJson(
  1. Map<String, dynamic>? json
)

Implementation

static CountryInfo? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return CountryInfo(
    countryCode: (json['country_code'] as String?) ?? '',
    name: (json['name'] as String?) ?? '',
    englishName: (json['english_name'] as String?) ?? '',
    flagEmoji: (json['flag_emoji'] as String?) ?? '',
    isHidden: (json['is_hidden'] as bool?) ?? false,
    callingCodes: List<String>.from(
        ((json['calling_codes'] as List<dynamic>?) ?? <dynamic>[])
            .map((item) => item as String)
            .toList()),
  );
}