renderRect method

void renderRect(
  1. Canvas canvas,
  2. Rect rect, {
  3. Paint? overridePaint,

Same as render, but takes both the position and the size as a single Rect.

Note: only use this if you are already using Rect's to represent both the position and dimension of your Sprite. If you are using Vector2s, prefer the other method.


void renderRect(
  Canvas canvas,
  Rect rect, {
  Paint? overridePaint,
}) {
    position: rect.topLeft.toVector2(),
    size: rect.size.toVector2(),
    overridePaint: overridePaint,