isTermInSearchHistory method

bool isTermInSearchHistory(
  1. {required String historyKey,
  2. required String searchTerm}
)

Get whether or not a certain searchTerm is in a certain history.

Implementation

bool isTermInSearchHistory({
  required String historyKey,
  required String searchTerm,
}) {
  SearchHistoryItem searchHistoryItem = SearchHistoryItem(
    searchTerm: searchTerm,
    historyKey: historyKey,
  );

  SearchHistoryItem? duplicateItem = _database.searchHistoryItems
      .getByUniqueKeySync(searchHistoryItem.uniqueKey);

  return duplicateItem != null;
}