Update your Flutter project to Flutter 2.0
Upgrade and Migrate Flutter project to 2.0
Follow these steps:
- 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.
- Run
flutter pub upgrade --null-safety
to upgrade all packages automatically - Check the code for errors and solve them
- Run
dart migrate
again and it should now be successfull. Follow the link to checkout the proposed changes - Press the "Apply Migration" button
- Check the code for errors again and fix them
Congratulations, 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: