HiveDataSource class final

The Hive engine: each collection is a Hive box, holding values under string keys.

Usually created through UnifiedDataSourceFactory.create with a HiveDataSourceConfig. Hive has no transactions, so transaction runs its action as is.

Implemented types

Constructors

HiveDataSource({required HiveDataSourceConfig config})
Creates a Hive data source for config. Call init before using it.

Properties

config → HiveDataSourceConfig
The configuration this data source was created with.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear(String collection) → Future<void>
Removes every entry in collection and keeps the collection.
override
containsKey(String collection, String key) → Future<bool>
Whether collection has a value under key.
override
count(String collection) → Future<int>
The number of entries in collection.
override
delete(String collection, String key) → Future<void>
Removes key from collection. Does nothing if it isn't there.
override
deleteAll(String collection, List<String> keys) → Future<void>
Removes every key in keys from collection.
override
dispose() → Future<void>
Closes the engine and releases its resources. Call init to use the data source again.
override
drop({String? collection}) → Future<void>
Removes collection, or every collection when it is null.
override
get<T>(String collection, String key) → Future<T?>
Returns the value under key in collection, or null if there is none.
override
getAll<T>(String collection) → Future<List<T>>
Returns every value in collection.
override
getAllKeys(String collection) → Future<List<String>>
Returns every key in collection.
override
getAllObjects<T>(String collection, DataModelAdapter<T> adapter) → Future<List<T>>
Returns every object in collection, using adapter to convert them from JSON.
override
getObject<T>(String collection, String key, DataModelAdapter<T> adapter) → Future<T?>
Returns the object under key in collection, or null if there is none, using adapter to convert it from JSON.
override
init() → Future<void>
Opens the engine. Calling it again on an open data source does nothing.
override
native<T>(String collection) → NativeCollectionAccessor<T>
Direct access to collection through the engine's own types, such as Hive type adapters or Isar collections.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openTypedBox<T>(String name) → Future<Box<T>>
Opens the box name typed as Box<T>, for values stored through a Hive type adapter, and returns it.
put<T>(String collection, String key, T value) → Future<void>
Stores value under key in collection, replacing any value there.
override
putAll<T>(String collection, Map<String, T> entries) → Future<void>
Stores every entry of entries in collection.
override
putAllObjects<T>(String collection, Map<String, T> entries, DataModelAdapter<T> adapter) → Future<void>
Stores every entry of entries in collection as JSON, using adapter to convert the values.
override
putObject<T>(String collection, String key, T value, DataModelAdapter<T> adapter) → Future<void>
Stores value under key in collection as JSON, using adapter to convert it.
override
query<T>(String collection, DataModelAdapter<T> adapter) → QueryBuilder<T>
Starts a query over the objects in collection, converted with adapter.
override
toString() → String
A string representation of this object.
inherited
transaction(Future<void> action()) → Future<void>
Runs action. Hive has no transactions, so this only checks init, and whatever action throws reaches the caller unchanged.
override
watch<T>(String collection, String key) → Stream<T?>
Emits the value under key in collection now, and again whenever it changes. Emits null while there is no value.
override
watchAll<T>(String collection) → Stream<List<T>>
Emits every value in collection now, and again whenever the collection changes.
override
watchAllObjects<T>(String collection, DataModelAdapter<T> adapter) → Stream<List<T>>
Emits every object in collection now, and again whenever the collection changes, using adapter to convert them.
override
watchObject<T>(String collection, String key, DataModelAdapter<T> adapter) → Stream<T?>
Emits the object under key in collection now, and again whenever it changes, using adapter to convert it. Emits null while there is none.
override

Operators

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

Constants

registryBoxName → const String
The box where the data source records the name of every collection it opens, so that drop can reach collections not opened in the current run. Don't use it as a collection name.