render method
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();
}