BundleEntity.fromJson constructor
BundleEntity.fromJson(
{ - required Map<String, dynamic> json,
})
Implementation
factory BundleEntity.fromJson({required Map<String, dynamic> json}) {
final jsonTranslations = (json['translations'] as Map).isEmpty
? <String, Map<String, dynamic>>{}
: Map.castFrom<String, dynamic, String, Map<String, dynamic>>(
json['translations']);
return BundleEntity(
projectId: json['project_id'] as String,
translationVersion: json['translation_version'] as int,
appVersion: json['app_version'] as String,
translations: jsonTranslations.map(
(locale, map) => MapEntry(
locale,
map.map(
(key, value) => MapEntry(
key,
Translation.fromJson(json: value) ??
SimpleTranslation(original: '', elements: []),
),
),
),
),
);
}