Create empty() factory for word search results
All checks were successful
Build database / evals (push) Successful in 35m56s

This commit is contained in:
2026-02-23 13:01:57 +09:00
parent 1783338b2a
commit 48f50628a1
2 changed files with 14 additions and 0 deletions

View File

@@ -81,6 +81,18 @@ class WordSearchResult {
sources: WordSearchSources.fromJson(json['sources']),
);
factory WordSearchResult.empty() => WordSearchResult(
score: 0,
entryId: 0,
isCommon: false,
japanese: [],
kanjiInfo: {},
readingInfo: {},
senses: [],
jlptLevel: JlptLevel.none,
sources: WordSearchSources.empty(),
);
String _formatJapaneseWord(WordSearchRuby word) =>
word.furigana == null ? word.base : '${word.base} (${word.furigana})';

View File

@@ -9,6 +9,8 @@ class WordSearchSources {
const WordSearchSources({this.jmdict = true, this.jmnedict = false});
factory WordSearchSources.empty() => const WordSearchSources();
Map<String, Object?> get sqlValue => {'jmdict': jmdict, 'jmnedict': jmnedict};
Map<String, dynamic> toJson() => {'jmdict': jmdict, 'jmnedict': jmnedict};