MapStream<K, V> class

A Map that supports listening to changes.

Implemented types

Constructors

MapStream()
Creates an empty MapStream
MapStream.from(Map<K, V?> other)
Creates a MapStream with the same keys and values as other.
MapStream.typeSafe([Map<K, V?>? other])
Creates a type safe MapStream.

Properties

entries Iterable<MapEntry<K, V?>>
The map entries of this.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
hasListener bool
Whether there are any subscribers.
no setter
isClosed bool
Whether the stream controller is closed for adding more events.
no setter
isEmpty bool
Whether there is no key/value pair in the map.
no setteroverride
isNotEmpty bool
Whether there is at least one key/value pair in the map.
no setteroverride
keys Iterable<K>
The keys of this.
no setteroverride
length int
The number of key/value pairs in the map.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
typeSafe bool
Flag whether typeChecking is performed on updates.
getter/setter pair
values Iterable<V?>
The values of this.
no setteroverride

Methods

addAll(Map<K, V?> other) → void
Adds all key/value pairs of other to this.
override
addEntries(Iterable<MapEntry<K, V?>> newEntries) → void
Adds all key/value pairs of newEntries to this.
override
asBroadcastStream() Stream<MapUpdate<K, V?>>
Returns a multi-subscription stream that emits the MapUpdates.
cast<RK, RV>() Map<RK, RV>
Unsupported for MapStream
override
clear() → void
Removes all entries from the map.
override
close() Future
Closes all attached streams.
connect(K key, Stream<V> stream) → void
Connect a stream to a key in the map.
containsKey(Object? key) bool
Whether this map contains the given key.
override
containsValue(Object? value) bool
Whether this map contains the given value.
override
disconnect(K key) → void
Disconnect a connected stream from a key in the map.
disconnectAll() → void
Disconnect all connected streams
forEach(void action(K key, V? value)) → void
Applies action to each key/value pair of the map.
override
listen(void onUpdate(MapUpdate mapUpdate), [List? keys]) StreamSubscription<MapUpdate<K, V?>>
Adds a subscription to this MapStream's stream.
map<K2, V2>(MapEntry<K2, V2> convert(K key, V? value)) Map<K2, V2>
Returns a new Map where all entries of this MapStream are transformed by the given convert function.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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
removeWhere(bool test(K key, V? value)) → void
Removes all entries of this map that satisfy the given test.
override
resend(K key) → void
Sends a MapUpdate down the stream with the key's MapEntry
resendAll() → void
Sends an empty MapUpdate down the stream to all attached listeners.
revert(K key) → void
Reverts key back to that in defaultMap.
revertAll() → void
Reverts all values back to defaultMap.
toMap() Map<K, V?>
Returns this MapStream as a Dart Map.
toString() String
Returns 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

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.
override
operator []=(K key, V? value) → void
Adds key/value pair to this.
override