【问题标题】:Expected a key while parsing a block mapping解析块映射时需要一个键
【发布时间】:2020-12-04 02:38:24
【问题描述】:

在 pubspec.yaml 中检测到错误:

 Error on line 48, column 4: Expected a key while parsing a block mapping.

pubspec.yaml:

flutter:
 uses-material-design: true
  assets:
 - images/googlelogo.png

【问题讨论】:

  • 'pubspec.yaml' 中的空格很重要,资产前必须正好有两个空格(- images/googlelogo.png //在这种情况下)以及所有属性必须在同一行

标签: mapping


【解决方案1】:

正如您在评论中提到的,缩进在 pubspec.yaml 文件中很重要。应该是这样的:


flutter:
  uses-material-design: true
  assets:
    - images/googlelogo.png

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-24
    • 2018-10-14
    • 2019-02-04
    • 2019-08-23
    • 1970-01-01
    • 2016-11-11
    • 2020-03-21
    相关资源
    最近更新 更多