DiagramPortShapeDefinition constructor
DiagramPortShapeDefinition({
- required PortShape shape,
- required String label,
- required Iterable<
DiagramPoint> contour, - 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}');
}
}