Ehsan Kalali
Ehsan Kalali

Reputation: 571

Error when add Provider package in flutter app

I want to add Provider package in my flutter app, but has error like follow image:

flutter pub pub add provider

enter image description here

This link don't solve it

Upvotes: 1

Views: 1104

Answers (3)

Ehsan Kalali
Ehsan Kalali

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

adrsh23
adrsh23

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

Kunal Pitale
Kunal Pitale

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

Related Questions