fromJsonStringMapList static method

Map<OpenFoodFactsLanguage, List<String>>? fromJsonStringMapList(
  1. dynamic map
)

From a Map<String, String> in dynamic's clothing (JsonKey annotation)

Implementation

static Map<OpenFoodFactsLanguage, List<String>>? fromJsonStringMapList(
    dynamic map) {
  if (map == null) {
    return null;
  }
  if (map is! Map<String, dynamic>) {
    throw Exception('Expected type: Map<String, List<String>>: $map');
  }
  final result = <OpenFoodFactsLanguage, List<String>>{};
  for (final key in map.keys) {
    final List<String> list = <String>[];
    for (final item in map[key]! as List<dynamic>) {
      list.add(item as String);
    }
    result[LanguageHelper.fromJson(key)] = list;
  }
  return result;
}