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
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
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.
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
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