4

I'm working on new application and i get this error on "parsing a block mapping"

I already tried this option :"https://stackoverflow.com/questions/55470780/error-on-line-55-column-4-of-pubspec-yaml-expected-a-key-while-parsing-a-block" but it won't work

fonts:
     - family: GoogleSans
       fonts:
         - asset: assets\fonts\GoogleSansRegular.ttf
            weight: 40
          

column 4 of pubspec.yaml: Expected a key while parsing a block mapping.

   ╷

70 │    fonts:

   │    ^

   ╵
Error detected in pubspec.yaml:
Rohan Singh
  • 20,497
  • 1
  • 41
  • 48
Aditya Sutar
  • 65
  • 2
  • 6

2 Answers2

3

Write fonts just below the code "#" as I drew for you in the picture

enter image description here

STA
  • 30,729
  • 8
  • 45
  • 59
YACINE
  • 31
  • 2
1

please check space and indent, Spaces are significant in YAML, the following is my working example

fonts:
    - family: icomoon
      fonts:
        - asset: assets/fonts/IcoMoon.ttf

    - family: Qwigley
      fonts:
        - asset: assets/fonts/Qwigley-Regular.ttf

    - family: Dosis
      fonts:
        - asset: assets/fonts/dosis/Dosis-Regular.otf
          weight: 400
        - asset: assets/fonts/dosis/Dosis-Medium.otf
          weight: 500
        - asset: assets/fonts/dosis/Dosis-SemiBold.otf
          weight: 600
        - asset: assets/fonts/dosis/Dosis-Bold.otf
          weight: 800
        - asset: assets/fonts/dosis/Dosis-ExtraBold.otf
          weight: 900

    - family: SourceHanSerifTC
      fonts:
        - asset: assets/fonts/SourceHanSerifTC/SourceHanSerifTC-ExtraLight.otf
          weight: 200
        - asset: assets/fonts/SourceHanSerifTC/SourceHanSerifTC-Light.otf
          weight: 300
        - asset: assets/fonts/SourceHanSerifTC/SourceHanSerifTC-Regular.otf
          weight: 400
        - asset: assets/fonts/SourceHanSerifTC/SourceHanSerifTC-Medium.otf
          weight: 500
        - asset: assets/fonts/SourceHanSerifTC/SourceHanSerifTC-SemiBold.otf
          weight: 600
        - asset: assets/fonts/SourceHanSerifTC/SourceHanSerifTC-Bold.otf
          weight: 800
chunhunghan
  • 51,087
  • 5
  • 102
  • 120