2

when I press (Ctrl+s) to save my pubspec.yaml on my flutter project, this display in output:

enter image description here

what's the problem? and how to fix it?

here's my pubspec.yaml file:

name: store_app
description: A new Flutter project.

publish_to: "none" # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  #firebase_auth: ^0.20.0+1
  #provider: ^4.3.3

  syncfusion_flutter_datepicker: ^19.4.48
  date_range_picker: ^1.0.5

  cupertino_icons: ^1.0.2
  intl: ^0.17.0
  image_picker: ^0.8.4+5
  pigeon: ^1.0.7
  google_fonts: ^2.0.0
  fluttertoast: ^8.0.8
  flutter_html: ^2.2.1
  url_launcher: ^6.0.20
  splash_screen_view:

dev_dependencies:
  flutter_test:
    sdk: flutter
 
  flutter_localizations:
    sdk: flutter
  flutter_lints: ^1.0.0


flutter:
  uses-material-design: true

  assets:
  assets/images/
   - images/
   - images/icon/password.png
   - images/icon/refresh.png
   - images/icon/store.png
   - images/icon/user.png
   - images/icon/SPLASH.png
   - images/facebook.jpg
   - images/google.jpg

here is the section where the error appear :

  fonts:
   - family: Schyler
     fonts:
       - asset: fonts/Almarai-Regular.ttf
razan
  • 23
  • 4

2 Answers2

1

Use this extension pubspec assist to your vscode IDE. Once installed go to pubspec.yaml and open command palette (Ctrl + Shift + P) and search "Pubspec Assist" and select "sort all depecdencies"

YAML has formatting rules. Learn more about YAML by googling.

BIS Tech
  • 17,000
  • 12
  • 99
  • 148
  • it tells me that my pubspec YAML file is invalid or contains errors. it sadly didn't work – razan Mar 26 '22 at 10:54
0

Just Remove the : from infront of fonts and indent it such that only 2 space from the starting point.

fonts:
  - family: Schyler
    fonts:
      - asset: fonts/Schyler-Regular.ttf
      - asset: fonts/Schyler-Italic.ttf

Here each children has 2 space far indentation from its parent.

nibukdk93
  • 292
  • 2
  • 13