How to solve Null-Safety in Flutter

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


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

enter image description here

Third Method:

To Enable null safety,

  1. Check Latest Dart Version(It should be Dart 2.12 or later:)dart --version
  2. Update the dart version, the above point not satisfied using the command.dart pub upgrade --null-safety dart pub get
  3. 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


Related Posts

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x
Artificial Intelligence Universe