sdk: ">=2.12.0 <3.0.0"
Then follow the 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.
Run flutter pub upgrade --null-safety to upgrade all packages automatically.
Check the code for errors and solve them (Very important).
Run dart migrate again and it should now be successful. Follow the link to checkout the proposed changes.
Press the "Apply Migration" button.
Check the code for errors again and fix them.
File image = File("/storage/emulated/0/Android/data/my_app/files/Pictures/image_214.png"); // Replace the path string with any valid path on your device if you want to test it out. out
String fileName = file.path.split('/').last;