Quantcast
Channel: Can't load an image from a library in Flutter - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Can't load an image from a library in Flutter

$
0
0

I need a library to load an SVG (using the flutter_svg package) located in the main app's assets directory. Right now I have the following code in the library function:

SvgPicture.asset(svgSrc, package: 'example_app')

Where svgSrc will be 'assets/images/logo.svg'.

However on flutter run I get the following exception:

Error while trying to load an asset: Failed to load asset at "assets/packages/example_app/assets/images/logo.svg" (404)══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════The following assertion was thrown resolving a single-frame picture stream:Unable to load asset: packages/example_app/assets/images/logo.svg

I have added the main app's pubspec.yaml I have:

assets:  - assets/images/

Where am I going wrong here?


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>