I’m facing the below error when I try to either run flutter pub get
command for dependency installation or running the entire project.
flutter pub get
Resolving dependencies... (3.2s)
The current Dart SDK version is 3.4.3.
Because logger 0.9.4 doesn't support null safety and no versions of logger match >0.9.4 <0.10.0, logger ^0.9.4 is forbidden.
So, because farmassist depends on logger ^0.9.4, version solving failed.
The lower bound of "sdk: '>=2.2.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.
I tried the following methods to resolve the issue but still it didn’t help
- Upgrading the logger package to the latest version
- Trying removing logger dependency from the code and see if it could work
2
Answers
try this:
1- remove the
pubspec.lock
file from the root of your project2- remove
logger
package from thepubspec.yaml
file3- run this
flutter pub add logger
command in your terminal4- run the
flutter pub get
command in your terminallet me know if it helped
Potential Reason
It happens because of following 2 reasons:
Any of the dependent library is outdated.
The constraints don’t satisfy the given configuration. In this case, following solution might help you out.
Generic Solution
The generic solution to most of the configuration problem is to start fresh
Start fresh, create a brand-new flutter project with the same name, in different folder/directory.
Copy the
lib
folder from the old one, and replace it in the new project.Install dependency manually like this,
This will (hopefully!) re-configure your project and will run smoothly onwards.