Today , I run flutter project and i got this error
Reason:in pubspec.yaml
I imported project from other person. When I try pub get it say requires SDK version >=2.12.0 <3.0.0, version solving failed. Then i Updated dart it through this error.
it is working fine below 2.12 sdk version
I changed my Dart SDK constraint from 2.7.0
to 2.10.0
, but it’s still showing this error
Solution:
Try this, Go to terminal and run this command; flutter run –no-sound-null-safety
Second Method
In Android Studio:
Run –> Edit Configurations –> Add Additional Run args –> –no-sound-null-safety
Third Method:
To Enable null safety,
- Check Latest Dart Version(It should be Dart 2.12 or later:)
dart --version
- Update the dart version, the above point not satisfied using the command.
dart pub upgrade --null-safety dart pub get
- Run the below command to know what are libs in your project needs to be upgraded to the latest null safety.
dart pub outdated --mode=null-safety