Flutter images not loaded (EXCEPTION: resolving an image codec)
Get rid of the leading /
in your path to the png. It should be images/p8.png
.
Also, consider using the cleaner Image.asset
constructor, for example:
new Image.asset('images/p8.png', width: 100.0, height: 100.0)
with new flutter version you also could put folders in pubspec.yaml, not only files
flutter:
uses-material-design: true
assets:
- images/
One thing to note is the 'assets:' tag must be correctly indented with the 'flutter:' tag, but it only throws an error occasionally when loading an asset. So this won't work:
flutter:
assets:
- images/
But this will:
flutter:
assets:
- images/
Add '/' correctly in all image paths
In Android Studio,
Tools->Flutter->Flutter Clean