Rectangle.fromCenter constructor
Constructs a Rectangle from a center point and a size.
Implementation
factory Rectangle.fromCenter({
required Vector2 center,
required Vector2 size,
}) {
final halfSize = size / 2;
return Rectangle.fromPoints(
center - halfSize,
center + halfSize,
);
}