fromJsonStringMapIsoUnique static method

String? fromJsonStringMapIsoUnique(
  1. dynamic map
)

Special case for ISO codes that should be unique for all languages.

e.g. "country_code_2": {"en": "BY"} will return 'BY'. From a Map<String, String> in dynamic's clothing (JsonKey annotation)

Implementation

static String? fromJsonStringMapIsoUnique(dynamic map) {
  if (map == null) {
    return null;
  }
  if (map is! Map<String, dynamic>) {
    throw Exception('Expected type: Map<String, String>');
  }
  for (final value in map.values) {
    return value! as String;
  }
  return null;
}