Rectangle class

Represent a rectangle in 2D space.

Inheritance

Constructors

Rectangle(num length, num width)
Constructs a Rectangle with a given length and width.
Rectangle.from({num? length, num? width, num? diagonal, num? perimeter, num? area})
Named constructor to create a Rectangle from various parameters.
Rectangle.fromAreaAndAspectRatio({required double area, required double aspectRatio})
Creates a rectangle from area and aspect ratio.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
length num
getter/setter pair
name String
The name of the geometric shape.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width num
getter/setter pair

Methods

anglesBetweenDiagonals() → ({Angle a, Angle b})
Calculates the angles between the diagonals of the rectangle.
area() num
Calculates the area of the 2D geometric shape.
override
aspectRatio() double
Calculates the aspect ratio of the rectangle.
diagonal() double
Calculates the diagonal length of the rectangle.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
perimeter() num
Calculates the perimeter of the 2D geometric shape.
override
perimeterRatio() double
Calculates the ratio of the perimeter to twice the diagonal of the rectangle.
toString() String
A string representation of this object.
inherited

Operators

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