StreamMap<K, V> constructor

StreamMap<K, V>({
  1. Map<K, V>? value,
  2. OnUpdate<Map<K, V>>? onUpdate,
  3. OnEvent<CollectionEvent<K, V>>? onEvent,
  4. OnChange<CollectionChangeEvent<K, V>>? onChange,
})

StreamMap wraps a Map and adds functionality to each relevant method to notify any subscribed listeners of changes made to the map.

value can be provided to return a StreamMap that references value, if null an empty list will be created instead. Note: Modifications made to the map by referencing value will not notify the listeners of the changes made to it.

onUpdate is a synchronous event called each time the collection is modified and receives the entire collection as a parameter.

onEvent is a synchronous event called each time the collection is modified, and receives a list of all of the affected elements.

onChange is a synchronous event called individually for every element added, removed, or updated in the collection.

Implementation

StreamMap({
  Map<K, V>? value,
  OnUpdate<Map<K, V>>? onUpdate,
  OnEvent<CollectionEvent<K, V>>? onEvent,
  OnChange<CollectionChangeEvent<K, V>>? onChange,
}) : super(value ?? <K, V>{},
          onUpdate: onUpdate, onEvent: onEvent, onChange: onChange);