format method

String format([
  1. int x0 = 0,
  2. int? y0,
  3. int? w0,
  4. int? h0,
])

Returns a formatted string representation of this rectangle.

Each component is formatted to a fixed number of decimal places. x0 sets the default precision for all components; individual overrides can be provided via y0, w0, and h0.

Example: [ X:<x>, Y:<y>, W:<width>, H:<height> ]

Implementation

String format([int x0 = 0, int? y0, int? w0, int? h0]) =>
  '[ '
    'X:${x.toStringAsFixed(x0)}, '
    'Y:${y.toStringAsFixed(y0 ?? x0)}, '
    'W:${width.toStringAsFixed(w0 ?? x0)}, '
    'H:${height.toStringAsFixed(h0 ?? x0)} '
  ']';