import 'dart:collection'; class AppText { late int textId; late String textKey; HashMap translations = HashMap(); AppText.fromJson(Map json) { textId = json['textId']; textKey = json['textKey']; if (json['translations'] != null && json['translations'].length > 0) { json['translations'].forEach((translation) { translations[translation['languageCode']] = translation['translation']; }); } } Map toJson() => { "textId": textId, "textKey": textKey, "translations": translations.toString(), }; @override String toString() { return toJson().toString(); } }