Home > Enterprise >  Changing fonts family in pubspec.yaml
Changing fonts family in pubspec.yaml

Time:06-20

I want to change the font family in pubspec.yaml but what happens when I run pub get isn't what I'm expecting. Here's what I did...

fonts:
  - family: Parisienne
      fonts:
       - asset: assets/fonts/Parisienne-Regular.ttf
     style: italic
     weight: 70 

and what I got after running pub get

[creepy_ipad] flutter pub get
Error detected in pubspec.yaml:
Error on line 70, column 12: Mapping values are not allowed here. Did you miss a colon earlier?
   ╷
70 │       fonts:
   │            ^
   ╵
Please correct the pubspec.yaml file at C:\Users\Khomotjo\creepy_ipad\pubspec.yaml
exit code 1

I honestly don't know what to do please help. THANK YOU

CodePudding user response:

It's indentation problem. Your pubspec.yaml should look like this:

fonts:
  - family: Parisienne
    fonts:
      - asset: assets/fonts/Parisienne-Regular.ttf
      style: italic
      weight: 70

Check the docs for more information.

CodePudding user response:

your style and weight should be align with the asset

For example:

      fonts:
       - asset: assets/fonts/Parisienne-Regular.ttf
<space>  style: italic
<space>  weight: 70 
  • Related