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

Only one image can't displays image asset – Flutter

I want to display an image in my app.
Like this :

class _OnBoardingDataPage1State extends State<OnBoardingDataPage1> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: SafeArea(
      child: SingleChildScrollView(
          child: SizedBox(
        width: double.infinity,
        child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              SizedBox(height: 5.h),
              Text(
                "MugiwarApp",
                textAlign: TextAlign.center,
                style: Theme.of(context).textTheme.titleLarge,
              ),
              SizedBox(
                height: 5.h,
              ),
              Image.asset(
                "assets/images/th-2465707242.png",
                height: 250.0,
                width: 250.0,
              )
            ]),
      )),
    ));
  }
}

Every images are displaying great, except ONE: my logo.

My pubspec.yaml :

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

flutter:
  assets:
    - assets/

I can’t figure why only my logo can’t be displayed.

>Solution :

Very basic issue, three steps to resolve.

1 – define asset correctly

flutter:
  assets:
    - assets/
    - assets/images/ 

2 – stop the application and run flutter clean.

3 – run flutter pub get.

now run the app, it will work fine.

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