MarkTheBeat
MarkTheBeat

Reputation: 5

Flutter pubspec.yaml error: No file or variants found for asset

my problem is that I am getting an error message saying:

Error detected in pubspec.yaml: No file or variants found for asset: svg/DriverLogoPlain.svg.

My pubspec.yaml:

flutter:
  uses-material-design: true
  assets:
    - svg/DriverLogoPlain.svg

My path to the svg image: PathImage

Anybody has some to this problem solution please?

Upvotes: 0

Views: 885

Answers (1)

Christopher Moore
Christopher Moore

Reputation: 17123

Your path in the code is incorrect. You're using assets/svg/DriverLogoOptimized.svg as the path in your Dart code, when it should be svg/DriverLogoOptimized.svg.

This may just be a copy-paste issue, but YAML is also whitespace sensitive, so you can't have flutter: indented so much.

Flutter also doesn't natively support SVGs so beware.


With more info from OP their folder was at the incorrect level. Your assets folder is one level too low. Move it to the same level as android. Not as a subdirectory.

Upvotes: 1

Related Questions