searchDictionaryResult method

Future<void> searchDictionaryResult(
  1. {required String searchTerm,
  2. required JidoujishoPopupPosition position}
)

Perform a search with a given query and update the dictionary search result. The position parameter determines where the pop-up will be shown on the screen.

Implementation

Future<void> searchDictionaryResult({
  required String searchTerm,
  required JidoujishoPopupPosition position,
}) async {
  late DictionarySearchResult dictionaryResult;
  _popupPositionNotifier.value = position;
  try {
    _isSearchingNotifier.value = true;
    dictionaryResult = await appModel.searchDictionary(
      searchTerm: searchTerm,
      searchWithWildcards: false,
    );

    appModel.addToDictionaryHistory(result: dictionaryResult);
    _dictionaryResultNotifier.value = dictionaryResult;
  } finally {
    _isSearchingNotifier.value = false;
  }
}