LabelDocument constructor

LabelDocument({
  1. required LabelSize size,
  2. LabelOrientation orientation = LabelOrientation.normal,
  3. required List<LabelElement> elements,
})

Implementation

LabelDocument({
  required this.size,
  this.orientation = LabelOrientation.normal,
  required List<LabelElement> elements,
}) : elements = List<LabelElement>.unmodifiable(elements) {
  for (final element in elements) {
    if (element case final LabelText text) {
      if (text.xMm + text.widthMm > size.widthMm ||
          text.yMm + text.heightMm > size.heightMm) {
        throw ArgumentError.value(
          element,
          'elements',
          'Text bounds must fit inside the label.',
        );
      }
    }
  }
}