Reputation: 27
It says: "Unexpected child "flutter" found under "flutter". for my pubspec.yaml file" twice when I followed the instructions that the developer website had. I am trying to add extra fonts to my flutter project.
I have tried taking out the "flutter:" code but then it just shows another error: Error on line 60, column 5 of pubspec.yaml: Expected a key while parsing a block mapping.
Also, I checked and the font files that I specified in the pubspec.yaml file were correct.
website link: https://flutter.dev/docs/cookbook/design/fonts
Thank you in advance!
name: greatapp
description: A new Flutter application.
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
flutter:
fonts:
- family: Futura
fonts:
- asset: fonts/Futura-Medium-01.ttf
- asset: fonts/Futura-MediumItalic-02.ttf
style: italic
I thought that it would just integrate the fonts but it didn't and yielded the errors that I described above.
Upvotes: 0
Views: 3440
Reputation: 653
assets:
- asset/images/
- asset/icons/
background: Image.asset(
"asset/images/brownie.jpg"
),
Upvotes: 0
Reputation: 11651
The spacing in this file is should be 2 units for each block.
fonts:
- family: Futura
fonts:
- asset: fonts/Futura-Medium-01.ttf
- asset: fonts/Futura-MediumItalic-02.ttf
style: italic
EDIT:
name: greatapp
description: A new Flutter application.
environment:
sdk: ">=2.2.2 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
fonts:
- family: Futura
fonts:
- asset: fonts/Futura-Medium-01.ttf
- asset: fonts/Futura-MediumItalic-02.ttf
style: italic
UPDATE:
Upvotes: 2