31 lines
680 B
Dart
31 lines
680 B
Dart
import 'dart:collection';
|
|
|
|
class AppText {
|
|
late int textId;
|
|
late String textKey;
|
|
|
|
HashMap<String, String> 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<String, dynamic> toJson() => {
|
|
"textId": textId,
|
|
"textKey": textKey,
|
|
"translations": translations.toString(),
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return toJson().toString();
|
|
}
|
|
}
|