ActiveRepo<TKey, TVal> class abstract

A synchronous repository based on Hive's Box

All keys and values can be accessed synchronously (since it's copied to memory)

Inheritance

Constructors

ActiveRepo()

Properties

boxName String
The name of the box.
no setterinherited
dataBox Box<TVal>
The hive box storing the data
no setter
dataStream Stream<Map<TKey, TVal>>
Notifies the user when any write operations occur.
no setter
firstOrNull MapEntry<TKey, TVal>?
Gets the first (key,value) stored in the box
no setter
firstOrNullKey → TKey?
get the first key, or null if the box is empty
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
keys Iterable<TKey>
All the keys in the box.
no setteroverride
keySet Set<TKey>
get the existing keys as a Set of unique values
no setterinherited
keySetStream Stream<Set<TKey>>
a stream that tracks keySet when it changes
no setterinherited
keyStream Stream<Iterable<TKey>>
a stream that tracks keys when it changes
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
valuesStream Stream<Iterable<TVal>>
Notifies the user when any write operations occur.
no setter

Methods

assignAll(Map<TKey, TVal> newValues) Future<void>
Clears the box then sets the keys and values provided in newValues.
override
clear() Future<void>
Deletes all the data in the box.
override
dataStreamFor(Iterable<TKey> keys) Stream<Map<TKey, TVal>>
Creates a stream that listens for specific keys
override
deleteKeys(Iterable<TKey?> keys) Future<void>
Deletes the keys provided in keys.
override
dispose() Future<void>
Closes the box.
override
firstEntryStream([Duration debounceDuration = const Duration(milliseconds: 200)]) Stream<MapEntry<TKey, TVal>?>
Stream that emits firstOrNull on every change for the box, with an optional debounce
override
getAllValues() Map<TKey, TVal>
Gets all the values stored in the box
getValueById(TKey? key, {TVal? defaultValue}) → TVal?
Gets the value based on the key
init() Future<void>
Initializes the repository.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(TKey key, TVal newValue) Future<void>
Updates the value at the given key to newValue.
inherited
putAll(Map<TKey, TVal> newValues) Future<void>
Sets the keys and values provided in newValues.
override
putAllAndUpdateExisting(Map<TKey, TVal> newValues, void mutateExisting(TKey key, TVal mutateMe, TVal newValueReadOnly)) Future<void>
Same as putAll, but instead of removing old objects, changes (mutates) their values to new values
override
putAllAndUpdateExistingMapped<TMapped>(Map<TKey, TMapped> newValues, TVal mutateExisting(TKey key, TVal? mutateMe, TMapped newValue)) Future<void>
Same as putAllAndUpdateExisting but mutateExisting can receive a null existing value
override
putAndUpdateExisting(TKey key, TVal newValue, void mutateExisting(TKey key, TVal? mutateMe, TVal newValueReadOnly)) Future<void>
Same as put, but instead of removing old object, changes (mutates) its values to newValue
inherited
toString() String
A string representation of this object.
inherited
watch({TKey? key}) Stream<BoxEvent>
watch the dataBox for changes to a specific key, use dataStreamFor instead
override

Operators

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