expand method

Rect expand(
  1. int amount
)

Create a new Rect by expanding all four sides of this rectangle outwards by the given amount. Calling with a negative amount will return a shrunken Rect (see shrink).

Implementation

Rect expand(int amount) {
  if (amount == 0) return this;
  if (amount < 0) return shrink(amount.abs());
  return Rect.sides(
      top - amount, right + amount, bottom + amount, left - amount);
}