src property

PortReference get src

The source driver port of the connection.

Implementation

PortReference get src {
  final p1ContainsP2 =
      point1.module.getHierarchyDownTo(point2.module) != null;
  final p2ContainsP1 =
      point2.module.getHierarchyDownTo(point1.module) != null;

  if (p1ContainsP2) {
    if (point1.direction == PortDirection.output) {
      return point2;
    } else {
      return point1;
    }
  } else if (p2ContainsP1) {
    if (point2.direction == PortDirection.output) {
      return point1;
    } else {
      return point2;
    }
  }

  return point1.direction == PortDirection.output ? point1 : point2;
}