close
flutter pub expected a key, pub expected a key, parsing a block mapping path flutter, Flutter Pub: Expected a key while parsing a block mapping. path:

Flutter Pub: Expected a key while parsing a block mapping. path:

Hello Guys. Many times we Face Flutter Pub: Expected a key while parsing a block mapping. path:. So in this tutorial, we are going to Solve this error.

How Flutter Pub: Expected a key while parsing a block mapping. path: Error Occurs ?

So Error That I have faced is as below.

Error on line 30, column 6 of pubspec.yaml: Expected a key while parsing a block mappingassets: ^

Here is my pubspec.yaml File:

  dependencies:  

  flutter:

  sdk: flutter

  cupertino_icons: ^0.1.0

  dev_dependencies:   

 flutter_test:

      sdk: flutter

    flutter:

    uses-material-design: true

      assets:

       - loadjson/person.json

How to Solve Flutter Pub: Expected a key while parsing a block mapping. path?

  1. How to Solve Flutter Pub: Expected a key while parsing a block mapping. path?

    to Solve Flutter Pub: Expected a key while parsing a block mapping. path It is because of the indentation of your code. Spaces are significant in YAML. so you have to manage all lines in indentation. in my case assets is indented too far. that's why I am facing that error. So its all About Spaces are significant in YAML so you cant add extra space in yaml file else it will cause error Flutter Pub: Expected a key while parsing a block mapping. path:

  2. Flutter Pub: Expected a key while parsing a block mapping path?

    to Solve Flutter Pub: Expected a key while parsing a block mapping. path It is because of the indentation of your code. Spaces are significant in YAML. so you have to manage all lines in indentation. in my case assets is indented too far. that's why I am facing that error. So its all About Spaces are significant in YAML so you cant add extra space in yaml file else it will cause error Flutter Pub: Expected a key while parsing a block mapping. path:

Solution 1: Set proper Indentation in your pubspec.yaml

It is because of the indentation of your code.

Spaces are significant in YAML. so you have to manage all lines in indentation.

in my case assets is indented too far. that’s why I am facing that error.

flutter_test:
  sdk: flutter

flutter:
  uses-material-design: true
  assets:
    - loadjson/person.json

So its all About Spaces are significant in YAML so you cant add extra space in yaml file else it will cause error Flutter Pub: Expected a key while parsing a block mapping. path:

Here is Git issue #1347

Summery

Now, Error is solved. If you still facing this error so Comment below your error with code. I Will help You. Comment below Your thoughts and your queries. And Also Comment on your suggestion here.

Also Check Out Below Tutorials


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *