'How can I load an SVG asset in a Flutter package? [duplicate]

I'm developing an UI components library and I want to use some SVG icons, I added them to the package's pubspec.yaml like this :

flutter:
  assets:
    - assets/
    - assets/svg/

And I tried to load the SVG file like this, to no avail:

 const String backArrow = 'assets/svg/back_arrow.svg';

I got an exception:

FlutterError (Unable to load asset: assets/svg/back_arrow.svg)

How can I properly load those assets in my package?



Solution 1:[1]

try this package from pub.dev: flutter_svg

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sun sreng