Turn off Null Safety for previous Flutter Project?


I want to upgrade my flutter to get new features such as null safety, but I didn’t want my previous project to affect them. I want new changes only for my new flutter project, I want to run my old project similar to the old way. Is there any way? Please guide me through it.

Thank You


The above answer wasn’t working for me after I upgraded to Dart v2.12 on the beta channel. So I found these options:

You can add this to the top of any dart file to disable null-safety checks.

// @dart=2.9

or similar to the answer above, I had to include a version prior to 2.12 to disable null safety. You would edit this line in the pubspec.yaml file.

  sdk: ">=2.11.0 <3.0.0"

Answered By – jaredbaszler

Answer Checked By – Timothy Miller (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *