Home > Software design >  How do I resolve this pubspec.yaml error?
How do I resolve this pubspec.yaml error?

Time:09-28

I facing a problem with my pubspec.yaml file. I added an image to my pubspec.yaml file, after adding it,when I run the flutter pub get, I got this error

Error detected in pubspec.yaml: Unexpected child "To add assets to your application, add an assets section, like this" found under "flutter". Please correct the pubspec.yaml file at /home/emmanuel/StudioProjects/gctu_app/pubspec.yaml Process finished with exit code 1

I also tried run flutter clean, flutter build , andpub upgrade, but that also produced the same error. Please how do I resolve it.

flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  To add assets to your application, add an assets section, like this:
  assets:
    - images/
  #   - images/a_dot_ham.jpeg

CodePudding user response:

You forget to add # before " To add assets to your application, add an assets section, like this:"

so your yml is

flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - images/
  #   - images/a_dot_ham.jpeg
  • Related