SearchHistoryRepository class

Repository for managing search history using Hive.

This class provides methods to save, retrieve, and manage the user's search history. It uses Hive for efficient local storage with automatic serialization.

Constructors

SearchHistoryRepository.new({required String boxName, int maxHistoryItems = 50})
Creates a search history repository.

Properties

boxName String
Name of the Hive box to store search history.
final
hashCode int
The hash code for this object.
no setterinherited
maxHistoryItems int
Maximum number of history items to retain.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addToHistory(String query) Future<void>
Saves a search query to history.
clearHistory() Future<void>
Clears all search history.
dispose() Future<void>
Closes the Hive box and releases resources.
getRecentSearches({int limit = 10}) List<String>
Retrieves recent search history.
initialize() Future<void>
Initializes the repository and opens the Hive box.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeFromHistory(String query) Future<void>
Removes a specific query from history.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited