Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

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

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

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

Refrence:https://stackoverflow.com/questions/66333667/cannot-run-with-sound-null-safety-because-the-following-dependencies-dont-supp

https://stackoverflow.com/questions/64621051/how-to-enable-null-safety-in-flutter

Related Posts

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Artificial Intelligence