0

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

Ehsan Kalali
  • 411
  • 6
  • 16

3 Answers3

1

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.

Ehsan Kalali
  • 411
  • 6
  • 16
0

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
Subarata Talukder
  • 5,407
  • 2
  • 34
  • 50
Kunal Pitale
  • 25
  • 11
0

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

adrsh23
  • 210
  • 2
  • 10