How to migrate old Flutter project to dart 3 with latest Flutter version.
My project works with following:
Flutter version: 3.7.12
sdk: ">=2.11.0 <3.0.0"
When I upgrade Flutter to latest version so I need to migrate the whole project to be compatible with Dart 3 with null safety…
It’s not easy to change the code (like variablers) manually in over 100 files.
Is there any way to migrate a Flutter project and change everything required to run dart 3 using commands in Terminal?
Thanks for help
2
Answers
You can use
dart migrate
command in dart 2.19if you want use dart 2.19, use Flutter 3.7.12 with
flutter downgrade 3.7.12
command.For more information, read this issue
Rather than downgrade flutter to ruin your main installation (although temporarily), consider using Puro instead, to maintain multiple versions of flutter at the same time. I have a nice video on that.