After sound null safety has arrived, projects that still have dependencies that have not upgraded to null safety yet, can still be run using --no-sound-null-safety
flag through the Flutter command.
But now I am trying to run the app through the android
project. The reason why I am trying to do this way is to allow me to debug a native Flutter plugin. I open the folder android
on Android Studio and when I try to run the project I receive an error:
Error: Cannot run with sound null safety, because the following dependencies don't support null safety:
If I was running through the Flutter command, the flag I mentioned would work here. But how do I set this flag when running the android
project through Android Studio?
Copy: --no-sound-null-safety and add into "additional run args". Run your app with "Run/Play" Button or from "Run" Menu. In this way, you can solve "Error: Cannot run with sound null safety, because the following dependencies don't support null safety" error on Flutter project.
Adding null safety to Dart and Flutter became a good solution to developer productivity issues and reduced the number of bugs. With null safety, now Flutter developers can specify which variables can be null and all the previously unnoticed errors will show up during static analysis.
Currently in standalone flutter project we can disable sound null safety by adding additional args --no-sound-null-safety but how to do this in add to app flutter in existing android app. There is no way to add args when running host android project.
You do not need to run the project through Android Studio, you can run it with the Flutter command and then attach the debugger using Android Studio. Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.
To test or run mixed-version code, you need to disable sound null safety. You can do this in two ways: Disable sound null safety using the --no-sound-null-safety flag to the dart or flutter command: $ dart --no-sound-null-safety run $ flutter run --no-sound-null-safety
Most people who’ve worked with Flutter have encountered null errors during runtime. They often look something like this: These examples are just a few of the runtime errors from not initializing a variable in your application. This is where Flutter’s null safety feature takes the center stage.
Change your edit configurations.
Add the flag --no-sound-null-safety
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With