Flutter: Packages have newer versions incompatible [Solved]

Packages have newer versions incompatible is a flutter error message. This message is visible in the terminal using these words: 5 packages have newer versions incompatible with dependency constraints.

Error message:

Changed 12 dependencies!
5 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

You can see flutter tell us that we must use ‘flutter pub outdated’. Let’s see how?

Steps to Solve Packages have Newer Versions Incompatible Error

Method No 1

  1. Go to the pubspec.yaml file
  2. Update the packages to the latest versions.
  3. In terminal run flutter clean
  4. Get packages by running flutter pub get

Method No 2 (Recommended)

  1. Open the terminal
  2. Write flutter pub outdated
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.2.1      10.2.1   
image_picker                      *0.6.5+3  *0.6.7+22   0.8.5+3     0.8.5+3  

dev_dependencies:                
flutter_lints                     *1.0.4    *1.0.4      2.0.1       2.0.1    

transitive dependencies:         
cross_file                        -         -           0.3.3+2     0.3.3+2  
flutter_plugin_android_lifecycle  *1.0.11   *1.0.11     2.0.7       2.0.7    
flutter_web_plugins               -         -           (sdk)       (sdk)    
http                              -         *0.12.2     0.13.5      0.13.5   
http_parser                       *3.1.4    *3.1.4      4.0.1       4.0.1    
image_picker_android              -         -           0.8.5+3     0.8.5+3  
image_picker_for_web              -         -           2.1.8       2.1.8    
image_picker_ios                  -         -           0.8.6+1     0.8.6+1  
image_picker_platform_interface   -         *1.1.6      2.6.1       2.6.1    
js                                -         -           0.6.4       0.6.4    
material_color_utilities          *0.1.5    *0.1.5      *0.1.5      0.2.0    
pedantic                          -         1.11.1      -           1.11.1   
plugin_platform_interface         -         *1.0.3      2.1.3       2.1.3    
source_span                       *1.9.0    *1.9.0      *1.9.0      1.9.1    
vector_math                       *2.1.2    *2.1.2      *2.1.2      2.1.4    

transitive dev_dependencies:     
lints                             *1.0.1    *1.0.1      2.0.0       2.0.0    
stream_channel                    *2.1.0    *2.1.0      *2.1.0      2.1.1    
test_api                          *0.4.12   *0.4.12     *0.4.12     0.4.14   

1 upgradable dependency is locked (in pubspec.lock) to an older version.
To update it, use `flutter pub upgrade`.

You get the list of outdated packages.

3. run this command in terminal

flutter pub upgrade --major-versions

This will upgrade the package versions automatically.

4. Clean the project by running

flutter clean

5. Get the packages

flutter pub get

Build the project and run the app. Your error about incompatibility will be gone.

Conclusion

You learn how you can solve the ‘your packages have the newer versions incompatible’ error in Flutter. You can also read these:

Thanks!

Hussain Humdani

Hussain Humdani

while ( ! ( succeed = try() ) );