Hive class
Open boxes and register adapters.
Constructors
- Hive()
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- defaultDirectory ↔ String?
-
The default directory for all boxes.
getter/setter pair
Static Methods
-
box<
E> ({String name = defaultName, String? directory, String? encryptionKey, int maxSizeMiB = 5}) → Box< E> -
Get or open the box with
name
in the givendirectory
. If no directory is specified, the default directory is used. -
closeAllBoxes(
) → void - Closes all open boxes.
-
compute<
T> (FutureOr< T> computation(), {String? debugName}) → Future<T> -
Runs
computation
in a new isolate and returns the result. Also takes care of initializing Hive and closing all boxes afterwards. -
deleteAllBoxesFromDisk(
) → void - Closes all open boxes and delete their data.
-
registerAdapter<
T> (String typeName, T? fromJson(dynamic json)) → void - Registers a type adapter to allow Hive to (de)serialize your objects.
Constants
- defaultName → const String
- The default name if you don't specify a name for a box.