handling for 'cat' model key
This commit is contained in:
parent
da6d64972b
commit
00cb1f1c75
2 changed files with 9 additions and 4 deletions
|
|
@ -108,7 +108,7 @@ class OneConstructUse {
|
|||
: null;
|
||||
debugger(when: kDebugMode && constructType == null);
|
||||
|
||||
final categoryEntry = json['categories'];
|
||||
final categoryEntry = json['cat'] ?? json['categories'];
|
||||
String? category;
|
||||
if (categoryEntry != null) {
|
||||
if ((categoryEntry is List) && categoryEntry.isNotEmpty) {
|
||||
|
|
|
|||
|
|
@ -21,10 +21,14 @@ class ConstructIdentifier {
|
|||
});
|
||||
|
||||
factory ConstructIdentifier.fromJson(Map<String, dynamic> json) {
|
||||
final categoryEntry = json['cat'];
|
||||
final categoryEntry = json['cat'] ?? json['categories'];
|
||||
String? category;
|
||||
if (categoryEntry != null && categoryEntry is String) {
|
||||
category = categoryEntry;
|
||||
if (categoryEntry != null) {
|
||||
if (categoryEntry is String) {
|
||||
category = categoryEntry;
|
||||
} else if (categoryEntry is List) {
|
||||
category = categoryEntry.first;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -46,6 +50,7 @@ class ConstructIdentifier {
|
|||
return {
|
||||
'lemma': lemma,
|
||||
'type': type.string,
|
||||
'cat': category,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue