Error on line 55, column 4 of pubspec.yaml: Expected a key while parsing a block mapping. fonts:

六眼飞鱼酱① 提交于 2019-12-13 10:26:12

问题


Error on line 55, column 4 of pubspec.yaml: Expected a key while parsing a block mapping. fonts:


回答1:


fonts: - family: Heebo fonts: - asset: fonts/Heebo-Regular.ttf - asset: fonts/Heebo-Bold.ttf weight: 700 - asset: fonts/Heebo-Black.ttf weight: 400

there is requre two spaces in between fonts and family




回答2:


1.In Android Studio, you need to create a package under lib folder. For example you create a package fonts (path is app_name/lib/fonts).

2.In the pubspec.yaml the code would look like:

flutter:
    fonts:
      - family: Oxygen
        fonts:
          - asset: app_widgets/lib/fonts/Oxygen-Regular.ttf
          - asset: app_widgets/lib/fonts/Oxygen-Bold.ttf
            weight: 700
          - asset: app_widgets/lib/fonts/Oxygen-Light.ttf
            weight: 300


来源:https://stackoverflow.com/questions/55470780/error-on-line-55-column-4-of-pubspec-yaml-expected-a-key-while-parsing-a-block

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!