Generate App Bundle with --no-sound-null-safety Flutter

Viewed 2529

I am trying to generate the App Bundle via Android studio (Build -> Generate Signed Bundle / APK), and I am running into an error when building a bundle.

Error: Cannot run with sound null safety, because the following dependencies
don't support null safety

Is there a way that I can add the argument --no-sound-null-safety, similar to what you can do in the command line?

3 Answers

Run

flutter build apk --split-per-abi --no-sound-null-safety

Credit

    run:
flutter build appbundle --no-sound-null-safety

Disable sound null safety using the --no-sound-null-safety flag to the dart or flutter command:

 dart --no-sound-null-safety run
 flutter build apk --split-per-abi --no-sound-null-safety

Alternatively, set the language version in the entrypoint — the file that contains main() function — to 2.9

// @dart=2.9
import 'src/my_app.dart';

main() {
  //...
}
Related