We’ll walk you through fixing the Flutter error “packages have newer versions incompatible with dependency constraints” in this post. When you add obsolete packages to the pubspec.yaml file, you get this error. To fix this problem, refer to the following solution:
Error:
Changed 25 dependencies!
14 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Solution of Error:
You must upgrade each package and plugin to the most recent version found in the pubspec.yaml file in order to fix this error. Alternatively, you can use the following instructions to solve it from the command terminal:
flutter pub outdated
This command will give you the list of packages that are outdated and needs to increase the version to the latest version.
Showing outdated packages.
[*] indicates versions that are not the latest available.
Package Name Current Upgradable Resolvable Latest
direct dependencies:
dio *3.0.10 *3.0.10 4.0.6 4.0.6
font_awesome_flutter *9.2.0 *9.2.0 10.1.0 10.1.0
image_picker *0.6.5+3 *0.6.5+3 0.8.5+3 0.8.5+3
path *1.8.1 *1.8.1 *1.8.1 1.8.2
dev_dependencies:
flutter_lints *1.0.4 *1.0.4 2.0.1 2.0.1
transitive dependencies:
async *2.8.2 *2.8.2 *2.8.2 2.9.0
string_scanner *1.1.0 *1.1.0 *1.1.0 1.1.1
transitive dev_dependencies:
lints *1.0.1 *1.0.1 2.0.0 2.0.0
7 dependencies are constrained to versions that are older than a resolvable version.
To update these dependencies, edit pubspec.yaml, or run `flutter pub upgrade --major-versions`.
The list of packages and dependencies that require version updates is as follows. You can manually modify the version code in the pubspec.yaml file to increase the version, or you can run the following command:
flutter pub upgrade --major-versions
Now, hit the commands below:
flutter clean
flutter pub get
Now run your app, and the error may be got solved.