How to add image in Flutter

前端 未结 8 1959
渐次进展
渐次进展 2020-12-01 01:10

I am developing Flutter app for the first time.. I have an issue in adding a image. I have a below questions :

  1. Where to create images folder?
  2. Where to
8条回答
  •  长情又很酷
    2020-12-01 01:57

    I think the error is caused by the redundant ,

    flutter:
      uses-material-design: true, # <<< redundant , at the end of the line
      assets:
        - images/lake.jpg
    

    I'd also suggest to create an assets folder in the directory that contains the pubspec.yaml file and move images there and use

    flutter:
      uses-material-design: true
      assets:
        - assets/images/lake.jpg
    

    The assets directory will get some additional IDE support that you won't have if you put assets somewhere else.

提交回复
热议问题