double constrainWidth([double width = double.INFINITY ])

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

Source

double constrainWidth([double width = double.INFINITY]) {
  assert(debugAssertIsValid());
  return width.clamp(minWidth, maxWidth);
}