DiagramPortShapeDefinition constructor

DiagramPortShapeDefinition({
  1. required PortShape shape,
  2. required String label,
  3. required Iterable<DiagramPoint> contour,
  4. double anchorDepth = .5,
})

Implementation

DiagramPortShapeDefinition({
  required this.shape,
  required this.label,
  required Iterable<DiagramPoint> contour,
  this.anchorDepth = .5,
}) : contour = List.unmodifiable(contour) {
  if (shape.name.trim().isEmpty ||
      shape.name != shape.name.trim() ||
      label.trim().isEmpty ||
      this.contour.length < 3 ||
      this.contour.any(
        (p) => !p.x.isFinite || !p.y.isFinite || p.x < 0 || p.x > 1,
      ) ||
      this.contour.any((p) => p.y < 0 || p.y > 1) ||
      !anchorDepth.isFinite ||
      anchorDepth < 0 ||
      anchorDepth > 1) {
    throw ArgumentError('Invalid port shape definition: ${shape.name}');
  }
}