this how I called image in my app
Image.asset('assets/user.jpg')
this is my pubspec.yaml
assets:
-assets/user.jpg
and I get this error
Exception has occurred. FlutterError (Unable to load asset: assets/user.jpg)
CodePudding user response:
You must consider indentation for assets in pubspec.yaml
assets:
- assets/user.jpg
CodePudding user response:
- Your indentation is not correct. It should be like this:
assets:
- assets/user.jpg
Make sure
user.jpg
is placed inassets
folder in your project's main directory (not insidelib
folder)After doing this, make sure you rebuild your app to see these changes.