HiveFlutterDatabaseAdapter class
A Database Adapter specially crafted to work with Flutter.
It initialized Hive using Hive.initFlutter
which will automatically ensure
the widget bindings are initialized and use the correct directory for
the given platform to store the hive files
(e.g. getApplicationDocumentsDirectory
)
Constructors
- HiveFlutterDatabaseAdapter({required String path, String name = 'hive'})
- A Database Adapter specially crafted to work with Flutter.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
The name of the adapter.
Must be unique when registering this DatabaseAdapter
finalinherited
- path → String
-
The path that should be used for hive
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
create(
Query query, LazyBox< JSON> box) → Future<QueryResult> -
Tries to store queries payload in hive box
inherited
-
delete(
Query query, LazyBox< JSON> box) → Future<QueryResult> -
Tries to delete payload from hive box
inherited
-
executeQuery(
Query query) → Future< QueryResult> -
Executes the query and returns the result.
The method should not throw but rather return a
QueryResult.failed
inherited -
getCreateQuery(
DatabaseStorable element) → Query -
generates a query that execute a create operation on the database
inherited
-
getDeleteQuery(
DatabaseStorable element) → Query -
generates a query that execute a delete operation on the database
inherited
-
getReadAllQuery(
{required String entityName}) → Query -
generates a query that execute a read operation on the database fetching
all objects
inherited
-
getReadAllWhereQuery(
{required String entityName, List< Constraint> where = const [], int? limit}) → Query -
generates a query that execute a read operation on the database by
applying a search function
inherited
-
getReadQuery(
String id, {Type? type, required String entityName}) → Query -
generates a query that execute a read operation on the database for an
object with a given id.
inherited
-
getStoreQuery(
DatabaseStorable element, {bool updateIfExists = false}) → Query -
generates a create or update query depending if the object should be
updated if it exists
inherited
-
getUpdateQuery(
DatabaseStorable element) → Query -
generates a query that execute a update operation on the database
inherited
-
init(
) → Future< void> - initialize the Hive package. Can be overriden to support flutter
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
Query query, LazyBox< JSON> lazyBox) → Future<QueryResult> -
Tries to fetch payload from hive box
inherited
-
selfDestruct(
) → Future< void> -
destroys all hive boxes that were opened by this adapter
Should only be used by the benchmark tool to cleanup.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
Query query, LazyBox< JSON> box) → Future<QueryResult> -
Tries to store queries payload in hive box
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited