Firstly lets create a default application using Flutter with below steps
After project is loaded, you can run the app using flutter run from terminal and make sure to open iOS simulator or Android Emulator before running. I am using iOS simulator for this demo
When project is loaded to simulator, it should present you with default app with a button that increments by 1 on App’s UI as below
Now create a folder called images and copy the image file into it. Also, just in case make file name to all small case.
As shown in above image, I have dropped flutter.png file into images folder. Flutter accepts wide range of image types like .Jpeg, .jpg, .gif and others
Now go to main.dart file and add image control into default stateful widget like Image.asset(‘images/flutter.png’) into the body section. As you can notice in below code, images are accepted using .asset method using Image object by passing images relative path into it as parameter.
Now run app using ‘flutter run’ in terminal, now should be able see the image on the screen as below
I hope this blog is useful to you, happy coding.
Here is the link to git