render method

void render(
  1. Canvas c,
  2. void renderGame(
    1. Canvas
    )
)

This transforms the canvas so that the coordinate system is viewport- -aware. All your rendering logic should be put inside the lambda.

Implementation

void render(Canvas c, void Function(Canvas) renderGame) {
  c.save();
  apply(c);
  renderGame(c);
  c.restore();
}