Flutter APK Errors while build apk command running?

Add this line on top of main.dart

// @dart=2.9

then run $flutter clean && flutter pub get


you can try this command also.

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