Create a folder in the root directory of your app called
assets
. Inside, place your image i.e.this_is_an_image.png
. The relative path will beassets\this_is_an_image.png
In
pubspec.yaml
, underflutter:
entry, type the following:
assets:
- assets/this_is_an_image.png
- I have been using it like that:
Container(
decoration: BoxDecoration(
image: const DecorationImage(
image: AssetImage('assets\this_is_an_image.png'),
fit: BoxFit.cover,
),
),
),
);