My Flutter project has a dependency flutter_dotenv
at version ^2.0.1
and I want to automatically upgrade to the new version ^2.0.2
.
I am running the following command to upgrade it:
flutter pub upgrade
Reference: Upgrading packages only
To update to the latest compatible versions of all the dependencies listed in the pubspec.yaml file, use the upgrade command:
flutter pub upgrade
However nothing seems to happen. pubspec.yaml
does not change, and the console output does not mention of a new version (which would be enough).
My pubspec.yaml
looks like this:
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_dotenv: ^2.0.1
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
Above method works but you can use this command:
flutter pub upgrade --major-versions
It will update all your dependencies.
Also check "How to correctly add dependencies to avoid "Version solving failed" error
Refer to this: https://stackoverflow.com/a/67517680/13500457