getSearchHistory method

List<String> getSearchHistory(
  1. {required String historyKey}
)

Get the search history for a given collection named historyKey.

Implementation

List<String> getSearchHistory({required String historyKey}) {
  List<SearchHistoryItem> items = _database.searchHistoryItems
      .filter()
      .historyKeyEqualTo(historyKey)
      .build()
      .findAllSync();

  List<String> history = items.map((item) => item.searchTerm).toList();

  return history;
}