MutableRectangle<T extends num> class

A class for representing two-dimensional axis-aligned rectangles with mutable properties.

Legacy: New usages of MutableRectangle are discouraged.

  • If you are using the MutableRectangle class with dart:html, we recommend migrating to package:web. To learn how and why to migrate, check out the migration guide.
  • If you want to store the boundaries of a rectangle in some coordinate system, consider using a record. Depending on how you will use it, this could look like var boundaries = (mixX: x1, maxX: x2, minY: y1, maxY: y2).
  • If you need to perform intersection calculations or containment checks, consider using a dedicated library, such as package:vector_math.
  • If you are developing a Flutter application or package, consider using the Rect type from dart:ui.
Implemented types


MutableRectangle(T left, T top, T width, T height)
Create a mutable rectangle spanned by (left, top) and (left+width, top+height).
MutableRectangle.fromPoints(Point<T> a, Point<T> b)
Create a mutable rectangle spanned by the points a and b;


bottom → T
The y-coordinate of the bottom edge.
no setterinherited
bottomLeft Point<T>
no setterinherited
bottomRight Point<T>
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
height ↔ T
The height of the rectangle.
getter/setter pair
left ↔ T
The x-coordinate of the left edge.
getter/setter pair
The x-coordinate of the right edge.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
top ↔ T
The y-coordinate of the left edge.
getter/setter pair
topLeft Point<T>
no setterinherited
topRight Point<T>
no setterinherited
width ↔ T
The width of the rectangle.
getter/setter pair


boundingBox(Rectangle<T> other) Rectangle<T>
Returns a new rectangle which completely contains this and other.
containsPoint(Point<num> another) bool
Tests whether another is inside or along the edges of this.
containsRectangle(Rectangle<num> another) bool
Tests whether this entirely contains another.
intersection(Rectangle<T> other) Rectangle<T>?
Computes the intersection of this and other.
intersects(Rectangle<num> other) bool
Returns true if this intersects other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.