Flutter assets error: EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE

This is how this resolved for me.

Previously I was using the exact paths to images as suggested

 assets:
 - assets/logo_linked_in.jpg
 - assets/logo_medium.png
 - assets/logo_stackoverflow.png
 - assets/myself.jpg
 - assets/sparta.jpg
 - assets/fox.png

Then I tried just the parent directory name, which was just using:

assets:
 - assets/

Voila! It worked like a charm!

I hope this helps someone.

P.S. - For newbies like me:

Make sure you have correctly indented the pubspec.yaml as this is very important for the build.


As far as I know currently only files directly placed under the registered directory are added to assets.

This should work:

flutter:
  uses-material-design: true
  assets:
   - assets/images/
   - assets/images/user/