Home > Net >  How to set custom icons
How to set custom icons

Time:08-11

Currently, I am trying to use my own image for an icon using

 ImageIcon(AssetImage("assets\icon\logo.png")
                      )

But this pops up enter image description here

My logo is in enter image description here and I copied relative path

CodePudding user response:

add your image to pubspec.yaml as an assets

enter image description here

an also you use wrong slash . it should be like below

  • change this
ImageIcon(AssetImage("assets\icon\logo.png"))
  • to this
ImageIcon(AssetImage("assets/icon/logo.png"))

CodePudding user response:

Change the slash

ImageIcon(AssetImage("assets/icon/logo.png"))
  • Related