首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何解决此pubspec.yaml错误?

如何解决此pubspec.yaml错误?
EN

Stack Overflow用户
提问于 2022-09-27 22:55:43
回答 1查看 45关注 0票数 0

我的pubspec.yaml文件面临一个问题。我在我的pubspec.yaml文件中添加了一个图像,添加之后,当我运行flutter pub get时,我得到了这个错误

中检测到pubspec.yaml错误:意外的子程序“要将资产添加到应用程序中,添加一个资产部分,如”在“颤振”下“找到”。请在用退出代码1完成的/home/emmanuel/StudioProjects/gctu_app/pubspec.yaml过程中更正pubspec.yaml文件

我还尝试了运行flutter cleanflutter buildpub upgrade,但这也产生了同样的错误。我该怎么解决这个问题。

代码语言:javascript
复制
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  To add assets to your application, add an assets section, like this:
  assets:
    - images/
  #   - images/a_dot_ham.jpeg
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-09-27 23:10:46

忘记在“向应用程序添加资产,添加资产部分”之前添加#,如下所示:

所以你的yml

代码语言:javascript
复制
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - images/
  #   - images/a_dot_ham.jpeg
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73874555

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档