LazyRepo<TKey, TVal> class
abstract
An asynchronous repository based on Hive's LazyBox.
Keys can be accessed synchronously but values need to be loaded asynchronously
Constructors
- LazyRepo()
Properties
- boxName → String
-
The name of the box.
no setterinherited
-
dataBox
→ LazyBox<
TVal> -
The hive box storing the data
no setter
-
firstOrNull
→ Future<
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
→ Set<
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
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(
) → Future< Map< TKey, TVal?> > - Gets all the values stored in the box.
-
getValueById(
TKey? key, {TVal? defaultValue}) → Future< 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
tonewValue
.inherited -
putAll(
Map< TKey, TVal> silentMap) → 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 valueoverride -
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