addAggregatedEvent method

void addAggregatedEvent(
  1. Event event
)

Implementation

void addAggregatedEvent(Event event) {
  // we want to add an event to the aggregation tree
  final relationshipType = event.relationshipType;
  final relationshipEventId = event.relationshipEventId;
  if (relationshipType == null || relationshipEventId == null) {
    return; // nothing to do
  }
  final events = (aggregatedEvents[relationshipEventId] ??=
      <String, Set<Event>>{})[relationshipType] ??= <Event>{};
  // remove a potential old event
  _removeEventFromSet(events, event);
  // add the new one
  events.add(event);
  if (onChange != null) {
    final index = _findEvent(event_id: relationshipEventId);
    onChange?.call(index);
  }
}