0

enter image description here

assets:
   - assets/
       
   fonts:
     - family: Schyler
       fonts:
        - asset: fonts/Schyler-Regular.ttf
        - asset: fonts/Schyler-Italic.ttf
  
    - family: Trajan Pro
      fonts:
        - asset: fonts/TrajanPro.ttf
        - asset: fonts/TrajanPro_Bold.ttf
         weight: 700

I wanted to add this font to assets

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
  • When you're writing YAML, your indentation needs to be consistent. In this case, your indentation level of the first `- family:` line is not the same as the indentation level of the second. – Abion47 Jan 23 '23 at 19:19

3 Answers3

1

your indentation is not correct pubspec.yaml is giving error when you have wrong indentation in it give a tab space before

fonts:

check out this screen shot and make the indentation like this enter image description here

Munsif Ali
  • 1,839
  • 1
  • 8
  • 22
0

It's more likely that the indentation of the whole block is wrong (or missing).

Read the following link.

A. Rokbi
  • 503
  • 2
  • 8
0

Try to follow the exact indentation from flutter

# The following section is specific to Flutter packages.
flutter:
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/

  fonts:
    - family: Schyler
      fonts:
        - asset: fonts/TrajanPro.ttf
        - asset: fonts/TrajanPro_Bold.ttf
          weight: 700

here every dot represent single space

enter image description here

Check more about adding assets-and-images.

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56