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
-
- Object
- ObservableMap<
K, V> - SunnyObservableMap
- 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< stream, {String? debugLabel, DiffEquality? diffEquality})K, V> > -
SunnyObservableMap.ofVStream(ValueStream<
Map< stream, {String? debugLabel, DiffEquality? diffEquality})K, V> >
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.
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.
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.
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< newEntries) → voidK?, V> > -
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 andRV
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 -
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< KK, VV> -
sync(
FutureOr< Map< newMap, {bool async = true}) → Future<K, V> >MapDiffs< K, V> > -
syncAndListenFrom(
Stream< Map< stream, {FutureOr<K, V> >Map< ? start}) → FutureK, V> ?> -
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
, ornull
ifkey
is not in the map.inherited -
operator []=(
K? key, V value) → void -
Associates the
key
with the givenvalue
.override