Reputation: 571
I want to add Provider package in my flutter app, but has error like follow image:
flutter pub pub add provider
This link don't solve it
Upvotes: 1
Views: 1104
Reputation: 571
I solved it :) The name of your project can not be equal to package name. The name of my project is provider and that is compiler gave an error.
Upvotes: 2
Reputation: 260
This error is caused due to versioning error.
In your pubspec.yaml file
dependencies:
provider:
Leave the version blank, it will automatically select the best one according to
the other packages.
After this run flutter pub get
Upvotes: 0
Reputation: 35
In your package's pubspec.yaml add this line like below. Then run pub get/pub upgrade:
dependencies:
provider: ^5.0.0
Note: Indentation must be considered. Not valid
dependencies:
provider: ^5.0.0
Upvotes: 1