applyTransform static method
Applies the unit-square → cell transform for size to canvas
(prefer this to pathFor: no allocation).
Implementation
static void applyTransform(Canvas canvas, Size size) {
final scale = math.max(size.width, size.height);
canvas
..translate((size.width - scale) / 2, (size.height - scale) / 2)
..scale(scale);
}