precompileExecutable method

Future<void> precompileExecutable(
  1. Executable executable, {
  2. List<String> additionalSources = const [],
  3. String? nativeAssets,
})

Precompiles executable .dart file at path to a snapshot.

The additionalSources, if provided, instruct the compiler to include additional source files into compilation even if they are not referenced from the main library.

The nativeAssets, if provided, instruct the compiler include a native assets map.

Implementation

Future<void> precompileExecutable(
  Executable executable, {
  List<String> additionalSources = const [],
  String? nativeAssets,
}) async {
  await log.progress('Building package executable', () async {
    ensureDir(p.dirname(pathOfSnapshot(executable)));
    return waitAndPrintErrors([
      _precompileExecutable(
        executable,
        additionalSources: additionalSources,
        nativeAssets: nativeAssets,
      ),
    ]);
  });
}