0
votes

I wanted import Http library on Dart. But,I'm getting the error when I run the flutter get packages on VScode.

This is my pubspec.yaml file

name: flutter_first_app
description: A new Flutter application.

version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
    http: 0.12.0 
 cupertino_icons: ^0.1.2
  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

The Error is

Error on line 13, column 2: Expected a key while parsing a block mapping. ╷ 13 │ cupertino_icons: ^0.1.2 │ ^ ╵ Please correct the pubspec.yaml file at F:\flutterprojects\flutter_first_app\pubspec.yaml

2

2 Answers

0
votes

Just add one space before the following in line your pubspec.yaml

cupertino_icons: ^0.1.2

Every space in pubspec.yaml file gets counted and important to manage.

0
votes

I was re-edited my pubspec.yaml file as below in this way the issue was fixed.

name: flutter_first_app
description: A new Flutter application.

version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  http: ^0.12.0 
  cupertino_icons: ^0.1.2


dev_dependencies:
  flutter_test:
    sdk: flutter