This is the folder structure of my app
.idea
.vscode
android
build
fonts
Oxygen-Bold.tff
Oxygen-Light.tff
Oxygen-Regular.tff
images
pizza0.png
pizza1.pn
After declaring correctly in pubspec.yaml, consider giving full path of the image ex.
'assets/images/about_us.png'
instead of just images/..
worked for me after wasting 2 hours on such a trivial error.
I have the same issue. I've just run "$ flutter clean"
, then everything is OK.
More about this error
Don't struggle to add the path to each image asset, instead just specify the path to your images directory.
just make sure you use proper indentations as the pubspec.yaml is indent sensitive.
flutter:
uses-material-design: true
assets:
- images/
and you can simply access each image as
new Image.asset('images/pizza1.png',width:300,height:100)
This issue still existed in my case even after,
flutter clean
(deletes build folder) and proper indentations in yaml file
It got fixed by itself, as it could be an issue related to Android Studio.
Fix 1) Restart the emulator in Cold Boot mode, In Android Studio, after clicking List Virtual Devices button, click Drop down arrow (last icon next to edit icon) => Choose Cold Boot Now option. If issue still exist, follow as below
Fix 2) After changing the emulator virtual device as a workaround,
For Example : From Nexus 6 to Pixel emulator
--happy coding!