Adding an Image Asset Flutter
1 min readSep 17, 2022
Recently I have been fluttering and I want to share how one can add an Image asset on flutter
First create and asset folder in the same directory as the pubsec.yaml file. Inside the asset folder create an images folder.
Inside the images folder add the images that you want to add in flutter.
Next step is to edit the pubsec.yaml file. Inside pubsec.yaml register your assets by adding the following lines
# To add assets to your application, add an assets section, like this:flutter:assets:- assets/images/imagename.jpg
If you have multiple images :
#incase of multiple images it is not a must to add the Image name
flutter:assets:- assets/images/
Save the pubsec.yaml file
You can now use your image inside your flutter code.
Image.asset('assets/images/imagename.jpg')
It is a simple as that