Rect class Core

A simple immutable rectangle defined by its top-left corner and size.

The Rect class represents a rectangular region in a 2D space using integer coordinates and dimensions. It is defined by:

  • the top-left corner (x, y)
  • the width and height of the rectangle

This class is typically used for layout, rendering bounds, or hit-testing in the terminal UI system.

Constructors

Rect.new({required int x, required int y, required int width, required int height})
Creates a Rect with the given x, y, width, and height.
const

Properties

bottom int
The vertical coordinate of the bottom edge of the rectangle.
no setter
hashCode int
The hash code for this object.
no setterinherited
height int
The height of the rectangle.
final
The horizontal coordinate of the right edge of the rectangle.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width int
The width of the rectangle.
final
x int
The horizontal coordinate of the top-left corner.
final
y int
The vertical coordinate of the top-left corner.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
Returns a string representation of the rectangle, including its position and size.
override

Operators

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