Working with Assets in Your Flutter App
in the flutter application sometimes we need to call some file and displaying to image in your Flutter App
now I will share how to add and display images using assets in Flutter, let’s get started
Create Flutter Project
here, I use Android Studio to create Flutter Project, let’s create a project named hello_image
then the project is successfully created, refer to the flutter official docs, we need to configure the assets in pubspec.yaml
let’s do that in the next step
Configure assets
An asset is a file that is bundled and deployed with your app and is accessible at runtime
add this to your pubspec.yaml
uncomment assets in `
assets:
- assets/
then create assets
directory in root project
Display to App
now after the complete configuration above let’s display to the app, for example, create a flutter basic application like this
then build and run the flutter application, let’s see the result
that’s how to display images in the flutter application, thank you for reading, hopefully it’s useful and good luck