constrain method

PrinterSize constrain(
  1. PrinterSize size
)

Returns the size that both satisfies the constraints and is as close as possible to the given size.

See also:

  • constrainDimensions, which applies the same algorithm to separately provided widths and heights.

Implementation

PrinterSize constrain(PrinterSize size) {
  PrinterSize result = PrinterSize(size.width == null ? null : constrainWidth(size.width!), size.height == null ? null : constrainHeight(size.height!));
  return result;
}