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

Created on 21 Oct 2015  路  9Comments  路  Source: dart-lang/pub

_From @Gen8 on October 21, 2015 10:22_

My pubspec.yaml contains this:

name: Name1
version: 2015.10.20
dependencies:
  test: ">=0.0.0"
  Name2: ">=0.0.0"
    path: ../Name2-2015-10-21

And I get this error:

Error on line 6, column 5 of pubspec.yaml: Expected a key while parsing a block mapping.
    path: ../tenum-2015-09-28
    ^

I get no error if I remove the version constraint for the Name2 package:

name: Name1
version: 2015.10.20
dependencies:
  test: ">=0.0.0"
  Name2:
    path: ../Name2-2015-10-21

_Copied from original issue: dart-lang/sdk#24663_

as designed

Most helpful comment

@AdarshaK it's probably a problem in your file wirh indentation

All 9 comments

_From @zoechi on October 21, 2015 11:43_

Can you please enclose the yaml content in triple-backticks (```). Formatting matters for yaml.
You can't have a path and a version constraint.

(I fixed the formatting in the original issue)

Your pubspec is invalid YAML. You're trying to specify ">=0.0.0" _and_ {path: ../Name2-2015-10-21} as values for the Name2 key, and that's not allowed.

Error on line 29, column 4 of pubspec.yaml: Expected a key while parsing a block mapping.
assets:
^
pub get failed (65)
i got above error
and this is my code
image: new AssetImage("assets/Histori.png"),
fit: BoxFit.cover,
//yaml
assets:
- assets/Histori.png

please help me

@AdarshaK it's probably a problem in your file wirh indentation

sir actually i am new to flutter,i want to show image in my app.

@AdarshaK that doesn't add any information to solve your case. I don't think this is the real place.
Please post the Question instead on StackOverflow including the content of the pubspec.yaml file
or ask in https://gitter.im/flutter/flutter

the problem is the indentation @madsager

Its Cause Of Extra Space in your pubspec.yaml file Here is Example Flutter Pub: Expected a key while parsing a block mapping. path:

Was this page helpful?
0 / 5 - 0 ratings