How to solve Null-Safety in Flutter
Today , I run flutter project and i got this error
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.10.0, but it’s still showing this error
Try this, Go to terminal and run this command; flutter run –no-sound-null-safety
In Android Studio:
Run –> Edit Configurations –> Add Additional Run args –> –no-sound-null-safety
To Enable null safety,
- Check Latest Dart Version(It should be Dart 2.12 or later:)
- 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