removeFromSearchHistory method

Future<void> removeFromSearchHistory(
  1. {required String historyKey,
  2. required String searchTerm}
)

Remove the searchTerm from a search history with the given historyKey.

Implementation

Future<void> removeFromSearchHistory({
  required String historyKey,
  required String searchTerm,
}) async {
  _database.writeTxnSync(() {
    SearchHistoryItem searchHistoryItem = SearchHistoryItem(
      searchTerm: searchTerm,
      historyKey: historyKey,
    );

    _database.searchHistoryItems
        .deleteByUniqueKeySync(searchHistoryItem.uniqueKey);
  });
}