lib/word_search: calculate isCommon
This commit is contained in:
@@ -10,6 +10,9 @@ class WordSearchResult {
|
||||
/// The ID of the entry in the database.
|
||||
final int entryId;
|
||||
|
||||
/// Whether the word is common or not.
|
||||
final bool isCommon;
|
||||
|
||||
/// The variants of the word in Japanese.
|
||||
final List<WordSearchRuby> japanese;
|
||||
|
||||
@@ -30,6 +33,7 @@ class WordSearchResult {
|
||||
|
||||
const WordSearchResult({
|
||||
required this.entryId,
|
||||
required this.isCommon,
|
||||
required this.japanese,
|
||||
required this.kanjiInfo,
|
||||
required this.readingInfo,
|
||||
@@ -40,6 +44,7 @@ class WordSearchResult {
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'entryId': entryId,
|
||||
'isCommon': isCommon,
|
||||
'japanese': japanese.map((e) => e.toJson()).toList(),
|
||||
'kanjiInfo':
|
||||
kanjiInfo.map((key, value) => MapEntry(key, value.toJson())),
|
||||
@@ -53,6 +58,7 @@ class WordSearchResult {
|
||||
factory WordSearchResult.fromJson(Map<String, dynamic> json) =>
|
||||
WordSearchResult(
|
||||
entryId: json['entryId'] as int,
|
||||
isCommon: json['isCommon'] as bool,
|
||||
japanese: (json['japanese'] as List<dynamic>)
|
||||
.map((e) => WordSearchRuby.fromJson(e))
|
||||
.toList(),
|
||||
|
||||
Reference in New Issue
Block a user