Recently Flutter team announced the Dart language now supports sound null safety! and is available in Dart 2.12 and Flutter 2. I want to migrate the app code to null safety.
How to migrate my packages to null safety,
It would be great if someone could give instructions about migrating to null-safety.
Run flutter upgrade
in the terminal to upgrade Flutter
Run dart migrate
to run the dart migration tool
Solve all errors which the migration tool shows
Run flutter pub outdated --mode=null-safety
to print all outdated
packages
You can see if the packages you depend upon support null-safety.
flutter pub upgrade --null-safety
to upgrade all packages
automaticallydart migrate
again and it should now be successful. Follow the
link to check out the proposed changes"Apply Migration"
buttonCongratulations, when finished you should now be able to run the app with sound null-safety.
Run flutter run
in the command line and the application should run with the command line displaying: