SunnyObservableMap<K, V> class

The normal ObservableMap class doesn't observe changes to the values bound to a key, eg "Let me know if contact 53 changes", so this class offers some additional connected observers that report changes to map keys

Inheritance
Mixed-in types
  • LoggingMixin
Implementers
Available extensions

Constructors

SunnyObservableMap({String? debugLabel, DiffEquality? diffDelegator})
SunnyObservableMap.of(Map<K, V> map, {String? debugLabel, DiffEquality? diffDelegator})
SunnyObservableMap.ofStream(Map<K, V> initial, Stream<Map<K, V>> stream, {String? debugLabel, DiffEquality? diffEquality})
SunnyObservableMap.ofVStream(ValueStream<Map<K, V>> stream, {String? debugLabel, DiffEquality? diffEquality})

Properties

changeController → StreamController<MapDiffs<K, V>>
final
changeStream → Stream<MapDiffs<K?, V?>>
no setter
debugLabel ↔ String?
getter/setter pair
entries → Iterable<MapEntry<K?, V>>
The map entries of this Map.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
Whether there is no key/value pair in the map.
no setterinherited
isNotEmpty → bool
Whether there is at least one key/value pair in the map.
no setterinherited
keys → Iterable<K?>
The keys of this Map.
no setterinherited
keysStream → HStream<Iterable<K?>>
Allows for observation of the maps keys as a list. Provides a means of disposing
no setter
length → int
The number of key/value pairs in the map.
no setterinherited
log → Logger
no setterinherited
loggerName → String
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stream → HStream<Map<K?, V?>>
no setter
subscribedTo ← StreamSubscription
no getter
values → Iterable<V>
The values of this Map.
no setterinherited
valueStream → ValueStream<Iterable<V>>
Allows for observation of the values as a list. Provides a means of disposing
no setter

Methods

addAll(Map<K?, V> other) → void
Adds all key/value pairs of other to this map.
override
addDisposer(EmptyCallback dispose) → void
addEntries(Iterable<MapEntry<K?, V>> newEntries) → void
Adds all key/value pairs of newEntries to this map.
override
applyChanges(MapDiffs<K, V> changes) → void
call(K key) → V?
cast<RK, RV>() → Map<RK, RV>
Provides a view of this map as having RK keys and RV instances, if necessary.
inherited
clear() → void
Removes all entries from the map.
inherited
containsKey(Object? key) → bool
Whether this map contains the given key.
inherited
containsValue(Object? value) → bool
Whether this map contains the given value.
inherited
dispose() → Future
forEach(void action(K? key, V value)) → void
Applies action to each key/value pair of the map.
inherited
getOrPut(K key, FutureOr<V> factory(K id)) → FutureOr<V>
keyStream(K key) → ValueStream<V?>
Allows for observation of a single map key.
map<K2, V2>(MapEntry<K2, V2> transform(K? key, V value)) → Map<K2, V2>
Returns a new map where all entries of this map are transformed by the given convert function.
inherited
mapEntriesObserved<KK, VV>(MapEntry<KK, VV> mapper(K? key, V? value), {String? debugLabel, DiffEquality? valueEquality}) → SunnyObservableMap<KK, VV>

Available on SunnyObservableMap<K, V>, provided by the SunnyObservableMapExtension extension

mapObserved<KK, VV>(Map<KK, VV> mapper(Map<K?, V?> current), {String? debugLabel, DiffEquality? valueEquality}) → SunnyObservableMap<KK, VV>

Available on SunnyObservableMap<K, V>, provided by the SunnyObservableMapExtension extension

newBuilder() → MapDiffs<K, V>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
observe(MapChangeListener<K, V> listener, {bool? fireImmediately}) → Dispose
inherited
observeKey(K key, Consumer<V?> react, {bool? fireImmediately}) → Dispose
push(Object? key, V value) → void
Forces an update, even in cases where the value at the key has not changed or is the same instance.
override
putIfAbsent(K? key, V ifAbsent()) → V
Look up the value of key, or add a new entry if it isn't there.
override
remove(Object? key) → V?
Removes key and its associated value, if present, from the map.
override
removeQuiet(Object? key) → void
Doesn't trigger observers
removes(Map<K, dynamic> newData) → Set<K?>
removeWhere(bool test(K? key, V value)) → void
Removes all entries of this map that satisfy the given test.
override
safeCast<KK, VV>() → Map<RK, RV>
sync(FutureOr<Map<K, V>> newMap, {bool async = true}) → Future<MapDiffs<K, V>>
syncAndListenFrom(Stream<Map<K, V>> stream, {FutureOr<Map<K, V>?>? start}) → Future
syncFromVStream(ValueStream<Map<K, V>> stream) → Future

Available on SunnyObservableMap<K, V>, provided by the SunnyObservableMapExtensions extension

toString() → String
A string representation of this object.
override
update(K? key, V update(V value), {V ifAbsent()?}) → V
Updates the value for the provided key.
override
updateAll(V update(K? key, V value)) → void
Updates all values.
override
watchKey(K key) → HStream<V?>

Operators

operator ==(Object other) → bool
The equality operator.
inherited
operator [](Object? key) → V?
The value for the given key, or null if key is not in the map.
inherited
operator []=(K? key, V value) → void
Associates the key with the given value.
override