I want to import both font and images to pubspec.yaml but it gives me an error why?
here is my code
flutter:
assets:
- assets/posts/
- assets/stories/
assets/avatars/
fonts:
- family: Klavika
fonts:
- asset: fonts\KlavikaBold.otf
CodePudding user response:
pubspec.yaml is sensitive to indentation. You have missed - for your avatar folder. Hope the code below should work.
flutter:
assets:
- assets/posts/
- assets/stories/
- assets/avatars/
fonts:
- family: Klavika
fonts:
- asset: fonts\KlavikaBold.otf
CodePudding user response:
Without "-" before assets/avatars/, dart understand that you want to add assets at directory assets/stories/ assets/avatars/ and of course this cause error.
You should follow doc https://flutter.dev/docs/development/ui/assets-and-images then add "-" before assets/avatars/ like previous answer of Bashistha.
