Exception caught by SVG in Flutter, which be the same problem even after I did svg clean in SVG Cleaner

Viewed 40

There is no problem with the assets path in the "pubspec.yaml" file because there are other svg that appear from the same path as well.

svg code after cleaning in SVG cleaner

<svg height="22" viewBox="0 0 34 22" width="34" xmlns="http://www.w3.org/2000/svg">
  <g fill="none" stroke="#e5b74b" stroke-linecap="round" stroke-linejoin="round">
    <path d="m34.5 10.5-10.5 7.5 10.5 7.5z" />
    <path
      d="m4.5 7.5h16.5a3 3 0 0 1 3 3v15a3 3 0 0 1 -3 3h-16.5a3 3 0 0 1 -3-3v-15a3 3 0 0 1 3-3z"
      transform="translate(-1 -7)"
    />
  </g>
</svg>

error:

════════ Exception caught by SVG ═══ Unable to load asset: packages/icons/assets/svgs/post_your_listing/Icon feather_video.svg ══════

just these lines without any details

enter image description here

my assets in the workspace, and just 7 icons not appearing in the flutter app, so the path in "pubspec.yaml" with no problem! enter image description here

in pubspec.yaml enter image description here

code:

SvgPicture.asset(
        icon,
        color: orange,
        height: 35,
        package: 'icons',
      ),
1 Answers

add you SVG assets file path in pubspec.yml like this

assets:
 - assets/test.svg

and then load SVG files via path

SvgPicture.asset(
    "assets/test.svg",
    color: orange,
    height: 35,
    package: 'icons',
  ),
Related