Reputation: 103
I am new to flutter and I got this error when I tried to run the flutter run
command. I found many articles related to this issue and got to know that flutter run --no-sound-null-safety
is the solution to this issue during development. But my question is that What if I get this error during the production build? How can I handle it there?
Upvotes: 0
Views: 5841
Reputation: 10186
flutter build <target> --no-sound-null-safety
works too (as does flutter test --no-sound-null-safety
FYI).
Note that this is a compilation error. If it fails, you won't get your APK (or whatever you're targeting), so this is not something you need to worry about happening "in production".
However, if you're new to Flutter, and the project is still young, consider trying to remove the null-unsafe dependencies. The command flutter pub outdated --mode=null-safety
will give you info on which packages don't support null safety, and whether they can be upgraded.
Upvotes: 2