isNormalized property

  1. @override
bool isNormalized
override

Returns whether the object's constraints are normalized. Constraints are normalized if the minimums are less than or equal to the corresponding maximums.

For example, a BoxConstraints object with a minWidth of 100.0 and a maxWidth of 90.0 is not normalized.

Most of the APIs on BoxConstraints expect the constraints to be normalized and have undefined behavior when they are not. In debug mode, many of these APIs will assert if the constraints are not normalized.

Implementation

@override
bool get isNormalized {
  return minWidth >= 0.0 &&
         minWidth <= maxWidth &&
         minHeight >= 0.0 &&
         minHeight <= maxHeight;
}