Open
Description
dart2native
's help documentation mentions an --enable-asserts
flag:
$ dart2native --help
Usage: dart2native <main-dart-file> [<options>]
Generates an executable or an AOT snapshot from <main-dart-file>.
-D, --define=<key=value> Set values of environment variables. To specify multiple variables, use multiple options or use commas
to separate key-value pairs.
E.g.: dart2native -Da=1,b=2 main.dart
--enable-asserts Enable assert statements.
-h, --help Display this help message.
-k, --output-kind=<aot|exe>
[aot] Generate an AOT snapshot.
[exe] (default) Generate a standalone executable.
-o, --output=<path> Set the output filename. <path> can be relative or absolute.
E.g.: dart2native main.dart -o ../bin/my_app.exe
-p, --packages=<path> Get package locations from the specified file instead of .packages. <path> can be relative or absolute.
E.g.: dart2native --packages=/tmp/pkgs main.dart
-v, --verbose Show verbose output.
However, when I try to compile a Dart executable with the --enable-asserts
flag, I get an error:
$ dart2native --enable-asserts --output=test test.dart
Setting VM flags failed: Unrecognized flags: enable-asserts
Failed to generate native files:
Generating AOT snapshot failed!
I need to run my executable with asserts enabled for testing purposes, and I want to do AOT compilation so my tests run quickly.
(Tested with Dart 2.7.0)