79593184

Date: 2025-04-25 19:20:01
Score: 1
Natty:
Report link

Inspired from @Aia Ashraf's answer:

import 'dart:ui' as ui;


Future<ui.Image> svgToImage(String assetPath, {int width = 100, int height = 100}) async {
  final pictureInfo = await vg.loadPicture(SvgAssetLoader(assetPath), null);
  final image = await pictureInfo.picture.toImage(50, 50);
  return image;
}

Then apply it to your paint like this:

final off = Offset(width, height);
canvas.drawImage(image!, off, solidFill);
Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @Aia
  • Low reputation (0.5):
Posted by: Onwuka Daniel