Translations.fromJson constructor
Implementation
factory Translations.fromJson(Map<String, Map<String, dynamic>> json) {
final translations = <Translation>[];
for (final languageGroup in json.entries) {
final language = languageGroup.key;
final languageTranslations = <Translation>[];
for (final translation in languageGroup.value.entries) {
languageTranslations.add(
Translation(
languageCode: language,
value: translation.value is Map
? TranslationValue.fromMap(translation.value)
: TranslationValue(value: translation.value),
code: translation.key,
),
);
}
translations.addAll(languageTranslations);
}
return Translations(translations: translations);
}