IsolatedBox<T> class

A Hive box that runs in an isolate.

Properties

hashCode int
The hash code for this object.
no setterinherited
isEmpty Future<bool>
Returns true if there are no entries in this box.
no setter
isNotEmpty Future<bool>
Returns true if there is at least one entries in this box.
no setter
isOpen Future<bool>
Whether this box is currently open.
no setter
keys Future<List>
All the keys in the box.
no setter
length Future<int>
The number of entries in the box.
no setter
name Future<String>
The name of the box.
no setter
path Future<String?>
The location of the box in the file system.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(T value) Future<int>
Saves the value with an auto-increment key.
addAll(Iterable<T> values) Future<List>
Saves all the values with auto-increment keys.
clear() Future<void>
Deletes all the entries in the box.
containsKey(dynamic key) Future<bool>
Checks whether the box contains the key.
delete(dynamic key) Future<void>
Deletes the given key from the box.
deleteAll(Iterable keys) Future<void>
Deletes all the given keys from the box.
deleteAt(int index) Future<void>
Deletes the n-th key from the box.
deleteFromDisk() Future<void>
Removes all entries from the box.
dispose() Future<void>
Closes the box.
flush() Future<void>
Induces compaction manually. This is rarely needed. You should consider providing a custom compaction strategy instead.
get(dynamic key, {T? defaultValue}) Future<T?>
Returns the value associated with the key. If the key does not exist, defaultValue is returned.
getAll() Future<List<T>>
Returns all the values from the box.
getAt(int index, {T? defaultValue}) Future<T?>
Returns the value associated with the n-th key. If the key does not exist, defaultValue is returned.
keyAt(int index) Future
Get the n-th key in the box.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(dynamic key, T value) Future<void>
Saves the key - value pair.
putAll(Map<dynamic, T> entries) Future<void>
Saves all the key - value pairs in the entries map.
putAt(int index, T value) Future<void>
Associates the value with the n-th key. An exception is raised if the key does not exist.
toString() String
A string representation of this object.
inherited
watch({dynamic key}) Stream<BoxEvent>
Returns a broadcast stream of change events. If the key parameter is provided, only events for the specified key are broadcast.

Operators

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

Static Methods

init<T>({required String boxName, FromJson<T>? fromJson, ToJson<T>? toJson, String? dirPath, MigrationStrategy? migrationStrategy}) Future<IsolatedBox<T>>
Initializes an IsolatedBox with the given parameters.