Home > OS >  Why is Flutter building without sound null safety
Why is Flutter building without sound null safety

Time:12-24

My pubspec.yaml has

environment:
  sdk: '>=2.15.0-116.0.dev <3.0.0'

When I run

flutter build appbundle/apk

it prints

Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Running Gradle task 'bundleRelease'...                              8.8s

Note: I have not opted out of null safety by using any of the workarounds. My entire project is 100% sound null safe. I'm also not looking for ways on how to build apk with sound null safety. The question is why is it printing Building without sound null safety when everything is setup correctly.


What I've tried:

flutter clean
flutter pub get

Restarted the editor, etc.

Running

dart pub outdated --mode=null-safety

prints

Showing dependencies that are currently not opted in to null-safety.
[✗] indicates versions without null safety support.
[✓] indicates versions opting in to null safety.

Package Name  Current  Upgradable  Resolvable  Latest  

direct dependencies: all support null safety.

dev_dependencies: all support null safety.
All dependencies opt in to null-safety.

CodePudding user response:

Apologize. It was my blunder.

One of my files was opted-out of null safety as I was using

// @dart=2.9

Once I removed it, the build started working again with null safety.

CodePudding user response:

flutter build apk --release --no-sound-null-safety
  • Related