Rectangle constructor

Rectangle({
  1. required double width,
  2. required double height,
  3. Point<num>? center,
})

Creates a Rectangle with the specified width, height, and center.

Implementation

Rectangle({required this.width, required this.height, Point<num>? center})
    : _center = center ?? const Point(x: 0, y: 0) {
  if (width < 0 || height < 0) {
    throw ArgumentError('Dimensions cannot be negative');
  }
}