clearSearchHistoryProvider top-level property

AutoDisposeProvider<void Function()> clearSearchHistoryProvider
final

Provider for clearing search history.

This is a mutation provider that clears all search history.

Implementation

final clearSearchHistoryProvider = Provider.autoDispose<void Function()>((ref) {
  return () async {
    final historyRepo = ref.read(searchHistoryRepositoryProvider);
    await historyRepo.initialize();
    await historyRepo.clearHistory();
    ref.invalidate(recentSearchesProvider);
  };
});