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
collectionand keeps the collection.override -
containsKey(
String collection, String key) → Future< bool> -
Whether
collectionhas a value underkey.override -
count(
String collection) → Future< int> -
The number of entries in
collection.override -
delete(
String collection, String key) → Future< void> -
Removes
keyfromcollection. Does nothing if it isn't there.override -
deleteAll(
String collection, List< String> keys) → Future<void> -
Removes every key in
keysfromcollection.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
keyincollection, 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, usingadapterto convert them from JSON.override -
getObject<
T> (String collection, String key, DataModelAdapter< T> adapter) → Future<T?> -
Returns the object under
keyincollection, or null if there is none, usingadapterto 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
collectionthrough 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
nametyped asBox<T>, for values stored through a Hive type adapter, and returns it. -
put<
T> (String collection, String key, T value) → Future< void> -
Stores
valueunderkeyincollection, replacing any value there.override -
putAll<
T> (String collection, Map< String, T> entries) → Future<void> -
Stores every entry of
entriesincollection.override -
putAllObjects<
T> (String collection, Map< String, T> entries, DataModelAdapter<T> adapter) → Future<void> -
Stores every entry of
entriesincollectionas JSON, usingadapterto convert the values.override -
putObject<
T> (String collection, String key, T value, DataModelAdapter< T> adapter) → Future<void> -
Stores
valueunderkeyincollectionas JSON, usingadapterto convert it.override -
query<
T> (String collection, DataModelAdapter< T> adapter) → QueryBuilder<T> -
Starts a query over the objects in
collection, converted withadapter.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 whateveractionthrows reaches the caller unchanged.override -
watch<
T> (String collection, String key) → Stream< T?> -
Emits the value under
keyincollectionnow, and again whenever it changes. Emits null while there is no value.override -
watchAll<
T> (String collection) → Stream< List< T> > -
Emits every value in
collectionnow, and again whenever the collection changes.override -
watchAllObjects<
T> (String collection, DataModelAdapter< T> adapter) → Stream<List< T> > -
Emits every object in
collectionnow, and again whenever the collection changes, usingadapterto convert them.override -
watchObject<
T> (String collection, String key, DataModelAdapter< T> adapter) → Stream<T?> -
Emits the object under
keyincollectionnow, and again whenever it changes, usingadapterto 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.