lib/search/kanji: add more data to result
This commit is contained in:
@@ -47,6 +47,23 @@ class KanjiSearchResult extends Equatable {
|
||||
/// (e.g. JIS213, JIS208, UCS, etc.)
|
||||
final Map<String, String> codepoints;
|
||||
|
||||
/// The kanji's nanori readings.
|
||||
///
|
||||
/// Nanori readings are special readings of kanji used in names.
|
||||
final List<String> nanori;
|
||||
|
||||
/// How to read this kanji in different languages.
|
||||
final Map<String, List<String>> alternativeLanguageReadings;
|
||||
|
||||
/// Common miscounts of the kanji's strokes.
|
||||
final List<int> strokeMiscounts;
|
||||
|
||||
/// Query codes for looking up this kanji in different indexing systems.
|
||||
final Map<String, List<String>> queryCodes;
|
||||
|
||||
/// References to other dictionaries that contain this kanji.
|
||||
final Map<String, String> dictionaryReferences;
|
||||
|
||||
const KanjiSearchResult({
|
||||
required this.kanji,
|
||||
required this.taughtIn,
|
||||
@@ -61,6 +78,11 @@ class KanjiSearchResult extends Equatable {
|
||||
required this.radical,
|
||||
required this.parts,
|
||||
required this.codepoints,
|
||||
required this.nanori,
|
||||
required this.alternativeLanguageReadings,
|
||||
required this.strokeMiscounts,
|
||||
required this.queryCodes,
|
||||
required this.dictionaryReferences,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -77,6 +99,13 @@ class KanjiSearchResult extends Equatable {
|
||||
// onyomiExamples,
|
||||
radical,
|
||||
parts,
|
||||
codepoints,
|
||||
kanji,
|
||||
nanori,
|
||||
alternativeLanguageReadings,
|
||||
strokeMiscounts,
|
||||
queryCodes,
|
||||
dictionaryReferences,
|
||||
];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
@@ -97,6 +126,11 @@ class KanjiSearchResult extends Equatable {
|
||||
// 'strokeOrderGifUri': strokeOrderGifUri,
|
||||
// 'uri': uri,
|
||||
'codepoints': codepoints,
|
||||
'nanori': nanori,
|
||||
'alternativeLanguageReadings': alternativeLanguageReadings,
|
||||
'strokeMiscounts': strokeMiscounts,
|
||||
'queryCodes': queryCodes,
|
||||
'dictionaryReferences': dictionaryReferences,
|
||||
};
|
||||
|
||||
factory KanjiSearchResult.fromJson(Map<String, dynamic> json) {
|
||||
@@ -122,6 +156,26 @@ class KanjiSearchResult extends Equatable {
|
||||
codepoints: (json['codepoints'] as Map<String, dynamic>).map(
|
||||
(key, value) => MapEntry(key, value as String),
|
||||
),
|
||||
nanori: (json['nanori'] as List).map((e) => e as String).toList(),
|
||||
alternativeLanguageReadings:
|
||||
(json['alternativeLanguageReadings'] as Map<String, dynamic>).map(
|
||||
(key, value) => MapEntry(
|
||||
key,
|
||||
(value as List).map((e) => e as String).toList(),
|
||||
),
|
||||
),
|
||||
strokeMiscounts:
|
||||
(json['strokeMiscounts'] as List).map((e) => e as int).toList(),
|
||||
queryCodes: (json['queryCodes'] as Map<String, dynamic>).map(
|
||||
(key, value) => MapEntry(
|
||||
key,
|
||||
(value as List).map((e) => e as String).toList(),
|
||||
),
|
||||
),
|
||||
dictionaryReferences:
|
||||
(json['dictionaryReferences'] as Map<String, dynamic>).map(
|
||||
(key, value) => MapEntry(key, value as String),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user