import 'dart:collection'; class Faq { late int faqId; late String name; late String description; int? sort; HashMap nameTranslations = HashMap(); HashMap descriptionTranslations = HashMap(); Faq.fromJson(Map json) { this.faqId = json['faqId']; this.name = json['name']; this.description = json['description']; this.sort = json['sort']; nameTranslations['en'] = name; descriptionTranslations['en'] = description; if (json['translations'] != null && json['translations'].length > 0) { json['translations'].forEach((translation) { nameTranslations[translation['languageCode']] = translation['nameTranslation']; descriptionTranslations[translation['languageCode']] = translation['descriptionTranslation']; }); } } Map toJson() => { "faqId": this.faqId, "name": this.name, "description": this.description, "nameTranslation": this.nameTranslations.toString(), }; @override String toString() => this.toJson().toString(); }