I can run an app in release mode on my phone with passing flag --no-sound-null-safety --release
, but
neither flutter build apk --enable-experiment=non-nullable
nor flutter build apk --no-sound-null-safety
nor flutter build apk --enable-experiment=non-nullable --no-sound-null-safety
will work
Just do this on your terminal
flutter build apk --split-per-abi --no-sound-null-safety
Or
flutter build apk --release --no-sound-null-safety
It was only necessary to use additional comment // @dart=2.9
before all imports in main.dart
so it could run without any flags
So main.dart
should look like this:
// @dart=2.9
import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart';
import '../init.dart';
Future<void> main() async {
GestureBinding.instance?.resamplingEnabled = true;
WidgetsFlutterBinding.ensureInitialized();
await init();
runApp(MyApp());
}
Any other .dart
files don't require annotating them
P.S. make sure you updated pubspec.yaml
for using Dart 2.12:
environment:
sdk: '>=2.12.0-0.0 <3.0.0'
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