HiveDatabase class
Hive CE implementation of DatabaseRepository.
Provides fast, local key-value storage using Hive Community Edition. Perfect for preferences, cached data, and offline-first applications.
Features:
- Zero native dependencies
- Fast read/write operations
- Automatic box management
- No encryption (use SecureStorageDatabase for sensitive data)
Example:
db.configure(
prefs: HiveDatabase(),
// ...
);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
delete(
String collection, String id) → Future< void> - Deletes a document from the database.
-
exists(
String collection, String id) → Future< bool> - Checks if a document exists.
-
existsWhere(
String collection, {required Map< String, dynamic> where}) → Future<bool> - Checks if any document matches the given criteria.
-
get(
String collection, String id, {dynamic defaultValue}) → Future< Map< String, dynamic> ?> - Retrieves a document from the database.
-
getAll(
String collection) → Future< Map< String, dynamic> ?> - Retrieves all documents from a collection.
-
init(
) → Future< void> - Initializes the database connection and required resources.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
query(
String collection, {Map< String, dynamic> where = const {}}) → Future<List< Map< >String, dynamic> > - Queries documents matching the specified criteria.
-
set(
String collection, String id, Map< String, dynamic> data) → Future<void> - Creates or overwrites a document in the database.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
String collection, String id, Map< String, dynamic> data) → Future<void> - Updates specific fields in an existing document.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited