I tried to just add (assets/ ) but that didn't solve the problem
Asked
Active
Viewed 1,161 times
0
-
Does this answer your question? [How to add image in Flutter](https://stackoverflow.com/questions/50903106/how-to-add-image-in-flutter) – OMi Shah Nov 04 '22 at 12:03
-
can you show us your assets folder? – eamirho3ein Nov 04 '22 at 12:04
2 Answers
0
The assets to specify in the pubspec should be inside the flutter
section.
flutter:
assets:
- assets/my_icon.png
- assets/background.png
also example with directories:
flutter:
assets:
- directory/
- directory/subdirectory/
Take a fast read to the official docs: https://docs.flutter.dev/development/ui/assets-and-images

Luka Cerrutti
- 667
- 1
- 4
- 9
0
Follow below steps
Create a new Folder name "assets" parallel to Lib folder
Create a folder name "images" in it.
Define a assets like a below in a "pubspec.yaml"
assets:
- assets/images/
Use it like a below
Image.asset("assets/images/my-profile.png"),

Kalpesh Khandla
- 758
- 1
- 9
- 22