MutableRectangle<T extends num> constructor

MutableRectangle<T extends num>(
  1. T left,
  2. T top,
  3. T width,
  4. T height
)

Create a mutable rectangle spanned by (left, top) and (left+width, top+height).

The rectangle contains the points with x-coordinate between left and left + width, and with y-coordinate between top and top + height, both inclusive.

The width and height should be non-negative. If width or height are negative, they are clamped to zero.

If width and height are zero, the "rectangle" comprises only the single point (left, top).

Implementation

MutableRectangle(this.left, this.top, T width, T height)
    : this._width = (width < 0) ? _clampToZero<T>(width) : width,
      this._height = (height < 0) ? _clampToZero<T>(height) : height;

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-math/MutableRectangle/MutableRectangle.html