StreamMap<K, V> class
StreamMap wraps a Map and adds functionality to each relevant method to notify any subscribed listeners of changes made to the map.
- Inheritance
-
- Object
- StreamValue<
Map< K, V> > - StreamEventProvider<
Map< K, V> , CollectionEvent<K, V> > - StreamCollection<
Map< K, V> , K, V> - StreamMap
- Implemented types
-
- Map<
K, V>
- Map<
Constructors
-
StreamMap({Map<
K, V> ? value, OnUpdate<Map< ? onUpdate, OnEvent<K, V> >CollectionEvent< ? onEvent, OnChange<K, V> >CollectionChangeEvent< ? onChange})K, V> > - StreamMap wraps a Map and adds functionality to each relevant method to notify any subscribed listeners of changes made to the map.
-
StreamMap.from(Map<
K, V> other, {OnUpdate<Map< ? onUpdate, OnEvent<K, V> >CollectionEvent< ? onEvent, OnChange<K, V> >CollectionChangeEvent< ? onChange})K, V> > -
Creates a StreamMap wrapped around a LinkedHashMap instance
that contains all key/value pairs of
other
.factory -
StreamMap.fromEntries(Iterable<
MapEntry< entries, {OnUpdate<K, V> >Map< ? onUpdate, OnEvent<K, V> >CollectionEvent< ? onEvent, OnChange<K, V> >CollectionChangeEvent< ? onChange})K, V> > -
Creates a new StreamMap where all entries of
entries
have been added in iteration order.factory -
StreamMap.fromIterable(Iterable iterable, {_Compute<
K> ? key, _Compute<V> ? value, OnUpdate<Map< ? onUpdate, OnEvent<K, V> >CollectionEvent< ? onEvent, OnChange<K, V> >CollectionChangeEvent< ? onChange})K, V> > -
Creates a StreamMap in which the keys and values are computed from the
iterable
.factory -
StreamMap.fromIterables(Iterable<
K> keys, Iterable<V> values, {OnUpdate<Map< ? onUpdate, OnEvent<K, V> >CollectionEvent< ? onEvent, OnChange<K, V> >CollectionChangeEvent< ? onChange})K, V> > -
Creates a StreamMap that wraps a Map instance associating the
given
keys
tovalues
.factory -
StreamMap.identity({OnUpdate<
Map< ? onUpdate, OnEvent<K, V> >CollectionEvent< ? onEvent, OnChange<K, V> >CollectionChangeEvent< ? onChange})K, V> > -
Creates a StreamMap that wraps an identity map with the default
implementation, LinkedHashMap.
factory
-
StreamMap.of(Map<
K, V> other, {OnUpdate<Map< ? onUpdate, OnEvent<K, V> >CollectionEvent< ? onEvent, OnChange<K, V> >CollectionChangeEvent< ? onChange})K, V> > -
Creates a StreamMap wrapped around a LinkedHashMap with the
same keys and values as
other
.factory
Properties
-
entries
→ Iterable<
MapEntry< K, V> > -
The map entries of this.
no setteroverride
- hasChangeEvent → bool
-
Returns
true
if there are any active change listeners or if onChange is set.no setterinherited - hasChangeListener → bool
-
Returns
true
if there are any active change listeners.no setterinherited - hasEvent → bool
-
Returns
true
if there are any active event listeners or if onEvent is set.no setterinherited - hasEventListener → bool
-
Returns
true
if there are any active event listeners.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- hasListener → bool
-
Returns
true
if there are any active listeners.no setterinherited - hasUpdate → bool
-
Returns
true
if there are any active update listeners or if onUpdate is set.no setterinherited - 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
- isObserved → bool
-
Returns
true
if there are any active listeners or if onUpdate is notnull
.no setterinherited -
keys
→ Iterable<
K> -
The keys of this.
no setteroverride
- length → int
-
The number of key/value pairs in the map.
no setteroverride
- numberOfChangeListeners → int
-
Returns the number of active change listeners.
no setterinherited
- numberOfEventListeners → int
-
Returns the number of active event listeners.
no setterinherited
- numberOfListeners → int
-
Returns the number of active listeners.
no setterinherited
-
onChange
↔ OnChange<
CollectionChangeEvent< ?K, V> > -
A synchronous event called individually for every element added,
removed, or updated in the collection.
getter/setter pairinherited
-
onEvent
↔ OnEvent<
CollectionEvent< ?K, V> > -
Called when an element is added, removed, or updated in the
list/map before onUpdate is called and before the listeners
are notified of the new value.
getter/setter pairinherited
-
onUpdate
↔ OnUpdate<
Map< ?K, V> > -
Called after value is updated, before the listeners are notified.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
value
↔ Map<
K, V> -
The value being observed.
getter/setter pairinherited
-
values
→ Iterable<
V> -
The values of this.
no setteroverride
- wasDisposed ↔ bool
-
Set to
true
when dispose is called.getter/setter pairinherited
Methods
-
addAll(
Map< K, V> other, {bool notifyListeners = true}) → void -
Adds all key/value pairs of
other
to this map.override -
addChangeListener(
OnChange< CollectionChangeEvent< onChange) → StreamSubscription<K, V> >CollectionChangeEvent< K, V> > -
Registers a new StreamSubscription that provides a
CollectionChangeEvent
denoting when an element has been added, removed, or updated in the collection.inherited -
addEntries(
Iterable< MapEntry< newEntries, {bool notifyListeners = true}) → voidK, V> > -
Adds all key/value pairs of
newEntries
to this map.override -
addEventListener(
OnEvent< CollectionEvent< onEvent) → StreamSubscription<K, V> >CollectionEvent< K, V> > -
Registers a new StreamSubscription that provides a
CollectionEvent denoting when any elements have been added,
removed, or updated in the collection.
inherited
-
addListener(
OnUpdate< Map< onUpdate) → StreamSubscription<K, V> >Map< K, V> > -
Creates, stores and returns a listener.
inherited
-
cast<
RK, RV> () → Map< RK, RV> -
Provides a view of this map as having
RK
keys andRV
instances, if necessary.override -
clear(
{bool notifyListeners = true}) → void -
Removes all entries from the map.
override
-
containsKey(
Object? key) → bool -
Whether this map contains the given
key
.override -
containsValue(
Object? value) → bool -
Whether this map contains the given
value
.override -
dispose(
) → void -
Cancels any active listeners and closes the stream.
inherited
-
forEach(
_ForEach< K, V> f) → void -
Applies
action
to each key/value pair of the map.override -
map<
K2, V2> (_Mapper< K, K2, V, V2> f) → Map<K2, V2> -
Returns a new map where all entries of this map are transformed by
the given
convert
function.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyAllListeners(
CollectionEventType type, K? key, V? value) → void -
Notifies every active update, event, and change listener, as well as
the onUpdate, onEvent, and onChange parameters of an event
affecting a single element.
inherited
-
notifyChangeListeners(
CollectionChangeEvent< K, V> event) → void -
Notifies all subscribed changes listeners of an
event
.inherited -
notifyEventListeners(
CollectionEvent< K, V> event) → void -
Notifies all subscribed event listeners of an
event
.inherited -
notifyListeners(
Map< K, V> event) → void -
Notifies all subscribed listeners of an
event
.inherited -
putIfAbsent(
K key, _IfAbsent< V> ifAbsent, {bool notifyListeners = true}) → V -
Look up the value of
key
, or add a new entry if it isn't there.override -
remove(
Object? key, {bool notifyListeners = true}) → V? -
Removes
key
and its associated value, if present, from the map.override -
removeChangeListener(
) → void -
Cancels and removes a change listener.
inherited
-
removeEventListener(
) → void -
Cancels and removes an event listener.
inherited
-
removeListener(
) → void -
Cancels and removes a StreamSubscription.
inherited
-
removeWhere(
_Predicate< K, V> predicate, {bool notifyListeners = true}) → void -
Removes all entries of this map that satisfy the given
test
.override -
setValue(
Map< K, V> value) → void -
Sets the observable value to
value
without notifying the event listeners.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
update(
K key, _Update< V> update, {_IfAbsent<V> ? ifAbsent, bool notifyListeners = true}) → V -
Updates the value for the provided
key
.override -
updateAll(
_Updater< K, V> update, {bool notifyListeners = true}) → void -
Updates all values.
override
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.override -
operator []=(
K key, V value) → void -
Associates the
key
with the givenvalue
.override
Static Methods
-
castFrom<
K, V, K2, V2> (Map< K, V> source, {OnUpdate<Map< ? onUpdate, OnEvent<K2, V2> >CollectionEvent< ? onEvent, OnChange<K2, V2> >CollectionChangeEvent< ? onChange}) → StreamMap<K2, V2> >K2, V2> -
Adapts
source
to be aStreamMap<K2, V2>
.override