Home > Net >  Image.asset - flutter
Image.asset - flutter

Time:02-03

When I try to use an image, the code gives me the following error:

error

But the code is working only with another image. When I try to use this one, it fails. This is the code:

Center(
            child: Image.asset(
                'assets/perigo.png'),
          )

Pubspeck.yaml file:

assets:
    - assets/

CodePudding user response:

check your image ("perigo.png") is correct, Type of image etc.


This work for me. try:

  • stop the running app and re-run it. (Not restart)

If it's not,

  • set your Pubspeck.yaml file like this,

    assets:
      - assets/perigo.png
    
  • Related