Reputation: 91
While trying to download packages to the flutter project im getting like:-
[project] flutter pub get
Running "flutter pub get" in project...
Error on line 25, column 5 of pubspec.yaml: A dependency may only have one source.
╷
25 │ ┌ sdk: flutter
26 │ │ curved_navigation_bar: ^0.3.3
27 │ │ # The following adds the Cupertino Icons font to your application.
28 │ │ # Use with the CupertinoIcons class for iOS style icons. ter 29 │ │ cupertino_icons: ^0.1.3
│ └──^
╵ pub get failed (65; ╵) exit code 65
Upvotes: 9
Views: 36030
Reputation: 3
Thats problem is due to package name and project name are same. so change the app name in pubspec.yml. name:_____
Upvotes: 0
Reputation: 1
I also have this problem. When I fix pubspec.yaml file as
flutter:
sdk: flutter
curved_navigation_bar: ^0.3.3
Problem solved.
Upvotes: 0
Reputation: 1
For me, the entire "dependencies" subsection was indented inwards. The entire "dependencies" subsection has to be as far back as possible
Upvotes: -1
Reputation: 71
Rename your project in pubspec.yaml file.
name: provider_app #! EDIT HERE
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.17.3 <3.0.0"
Upvotes: 0
Reputation: 71
I solve this error by changing the project name, this error occurs because of the same dependency name you use as project name.
Upvotes: 6
Reputation: 31
I think your project name is same as your dependencies name
Upvotes: 2
Reputation: 3
I had the same problem and found this fix
Take note of the indentation difference
//Correct way to add dependencies in flutter
dependencies:
flutter:
sdk: flutter
# Carousel Dependecy for sliders
carousel_pro: ^1.0.0
Instead Of:
//Wrong way of adding dependencies in flutter
dependencies:
flutter:
sdk: flutter
# Carousel Dependecy for sliders
carousel_pro: ^1.0.0
Upvotes: 0
Reputation: 12673
You got that error because your pubspec.yaml
is not well formatted.
You should have it as
flutter:
sdk: flutter
curved_navigation_bar: ^0.3.3
and not
dependencies:
flutter:
sdk: flutter
curved_navigation_bar: ^0.3.3
Upvotes: 13