Home > OS >  Error on line 13, column 5 of pubspec.yaml: A dependency may only have one source
Error on line 13, column 5 of pubspec.yaml: A dependency may only have one source

Time:02-13

I am getting an error while downloading packages in Dart Flutter. In the pubspec.yaml file, I added the following package:

dependencies:
  flutter:
    sdk: flutter
    flutter_easyloading: ^3.0.3
  cupertino_icons: ^1.0.2

The package I want to install is flutter_easyloading.


enter image description here

I press the "Get packages" button in Visual Studio code and I get this error:

[flutterapppproject] flutter pub get
Running "flutter pub get" in flutterapppproject...              
Error on line 13, column 5 of pubspec.yaml: A dependency may only have one source.
   ╷
13 │ ┌     sdk: flutter
14 │ │     shared_preferences: v0.4.2
15 │ │     flutter_easyloading: ^3.0.3
16 │ └ 
   ╵
pub get failed (65;    ╵)
exit code 65

All codes:

name: flutterapppproject
description: A new Flutter project.

publish_to: 'none'

version: 1.0.0 1

environment:
  sdk: ">=2.15.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
    flutter_easyloading: ^3.0.3
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^1.0.0

flutter:
  uses-material-design: true

CodePudding user response:

name: flutterapppproject
description: A new Flutter project.

publish_to: 'none'

version: 1.0.0 1

environment:
  sdk: ">=2.15.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_easyloading: ^3.0.3 // Changed the indentation here
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^1.0.0

flutter:
  uses-material-design: true`enter code here`

The issue seems to be with your indentation. Use the updated code and try making a "flutter pub get"

  • Related