connectedPorts property

Map<String, Set<String>> connectedPorts
latefinal

Port ids bound by a connector endpoint, keyed by element id.

Implementation

late final Map<String, Set<String>> connectedPorts = () {
  final result = <String, Set<String>>{};
  for (final element in elements) {
    if (element is! ResolvedConnector) continue;
    for (final endpoint in [element.source.start, element.source.end]) {
      if (endpoint case BoundEndpoint(:final elementId, :final portId?)) {
        (result[elementId] ??= {}).add(portId);
      }
    }
  }
  return Map<String, Set<String>>.unmodifiable(result);
}();