Reputation: 45
The image is not displayed, like all the paths are correctly set. You can see the code.
Upvotes: 1
Views: 217
Reputation: 2956
The issue is because of indentation. Try using a reformat of pubspec file and it will work perfectly.
Try like below Example:
name: my_flutter_app
description: A new Flutter application.
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true,
assets:
- assets/images/icon1.png
- assets/images/icon2.png
- assets/images/icon3.png
- assets/images/icon4.png
- assets/images/icon5.png
*dash (-) of image must be below the second 's' of assets.
Upvotes: 2
Reputation: 14033
You are getting the error because your indentation in the pubspec.yalm
file is wrong.
Try correcting the indentation. Use the code below: It works perfectly fine.
flutter:
assets:
- assets/images/icon1.png
- assets/images/icon2.png
- assets/images/icon3.png
- assets/images/icon4.png
- assets/images/icon5.png
I hope this helps
Upvotes: 1