render method

void render(
  1. Canvas canvas,
  2. Vector2 size, {
  3. Paint? overridePaint,
})

Renders the svg on the canvas using the dimensions provided by size.

Implementation

void render(
  Canvas canvas,
  Vector2 size, {
  Paint? overridePaint,
}) {
  final localSize = size.toSize();
  final image = _getImage(localSize);

  if (image != null) {
    canvas.save();
    canvas.scale(1 / pixelRatio);
    final drawPaint = overridePaint ?? _paint;
    canvas.drawImage(image, Offset.zero, drawPaint);
    canvas.restore();
  } else {
    _render(canvas, localSize);
  }
}