sdk
sdk copied to clipboard
I wish for `dart run --aot`
For small Dart binaries with few dependencies, dart run binary.dart is sufficient.
For larger binaries, where you can afford to run a resident compiler as you make changes:
dart run --resident binary.dart
There are a lot of shell scripts, python scripts, and Dart code that essentially does something like:
// Pseudo code
final snapshot = await compileScriptIfChangesMade(pathToDartFile);
await runSnapshot(snapshot);
... because the binary is not expected to change often (--resident is less helpful), or even we'd want to take advantage of AOT compilation. I'd love for this to be as easy as dart run binary.dart --snapshot-kind=aot-snapshot, or similar.
Are you suggesting that dart run --aot binary.dart would detect if binary.dart had changed / was run for the first time and generate an AOT snapshot to be reused on future runs?
Yes. Basically I'd love for something like the myriad of wrapper shell scripts in Flutter and the engine to just be handled by dart run.