StreamSet<E> constructor

StreamSet<E>({
  1. Set<E>? value,
  2. OnUpdate<Set<E>>? onUpdate,
  3. OnEvent<CollectionEvent<int, E>>? onEvent,
  4. OnChange<CollectionChangeEvent<int, E>>? onChange,
})

StreamSet wraps a Set and adds functionality to each relevant method to notify any subscribed listeners of changes made to the set.

value can be provided to return a StreamSet 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

StreamSet({
  Set<E>? value,
  OnUpdate<Set<E>>? onUpdate,
  OnEvent<CollectionEvent<int, E>>? onEvent,
  OnChange<CollectionChangeEvent<int, E>>? onChange,
}) : super(
        value ?? <E>{},
        onUpdate: onUpdate,
        onEvent: onEvent,
        onChange: onChange,
      );