Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run android project from a Flutter project with unsound null safety

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?

like image 811
Leonardo da Silva Avatar asked Mar 15 '21 19:03

Leonardo da Silva


People also ask

How do you resolve the null safety error in Flutter?

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.

IS null safety good in Flutter?

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.

How to disable sound null safety in add to app flutter?

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.

How do I run a flutter project in Android Studio?

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.

How do I test mixed-version code in flutter?

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

What is a null error in flutter?

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.


1 Answers

  1. Change your edit configurations.

    enter image description here

  2. Add the flag --no-sound-null-safety

    enter image description here

like image 198
CopsOnRoad Avatar answered Dec 05 '22 20:12

CopsOnRoad