'Because testing_app requires SDK version >=2.16.1 <3.0.0, version solving failed. in flutter
I am learning more about testing and i want to use Mockito Package and Build Runner Packate then i have my class Cat inside lib/models/cat.dart
then i have my lib/test/cat_test.dart file to test cat class
this is my pubspec.yaml (part of it)
The problem is thrown when i want to run the next command :
dart run build_runner build
and the problem is the next:
Resolving dependencies in /Users/adm/Documents/Things of david/PRACTICAS/Flutter/testing_app... The current Dart SDK version is 2.15.1. Because testing_app requires SDK version >=2.16.1 <3.0.0, version solving failed.
Flutter doctor:
thank you so much for your help.
Solution 1:[1]
The answer is in the error message:
The current Dart SDK version is 2.15.1. Because testing_app requires SDK version >=2.16.1 <3.0.0, version solving failed.
It means that the project needs Dart SDK in version 2.16.1 (at least), and your version is 2.15.1.
You should upgrade your Flutter version with flutter upgrade. For more info see the documentation.
Solution 2:[2]
I had a similar problem and solved it by changing the environment sdk version.
Open the project pubspec yaml file and next to environment: sdk:, change the version number to the minimum version required by the package or app as instructed in the error message.
I had to downgrade my sdk version from from ">=2.17.0-182.0.dev <3.0.0" to ">=2.16.0-182.0.dev <3.0.0".
Solution 3:[3]
Flutter upgrade solves this. Kindly try it
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | pszklarska |
| Solution 2 | Sharon |
| Solution 3 | Victorhez |





