Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Trouble with Image Rendering in Flutter – Seeking Guidance

Good afternoon to everyone.

I am a very new developer on flutter, and I made a simple app, to show an image

void main() {
  runApp(MaterialApp(
    home: Scaffold(backgroundColor: Colors.blueGrey,
      appBar: AppBar(
        centerTitle: true,
        backgroundColor: Colors.purpleAccent,
        title: Text("I am Rich"),
      ) ,
      body: Center(
        child: Image(
          image: AssetImage('Images/diamond.png'),
        ),
      ),
    )
  ));
}

I followed the flutter documentation, to resolve this issue

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

https://docs.flutter.dev/ui/assets/assets-and-images

I specify in my yaml file

flutter:
  uses-material-design: true
  assets:
   - Images/

in the console I get

======== Exception caught by image resource service ================================================
The following assertion was thrown resolving an image codec:
Unable to load asset: "Images/diamond.png".

and my folder is named Images

>Solution :

Use all lowercase letters for assets folder path.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading