runDart method

Future<int> runDart(
  1. List<String> arguments, {
  2. String? workingDirectory,
  3. bool useProjectCache = true,
  4. Map<String, String> environment = const {},
})

Runs dart with arguments in workingDirectory, with output going to the user. In project mode, pub uses the project cache unless useProjectCache is false.

Implementation

Future<int> runDart(
  List<String> arguments, {
  String? workingDirectory,
  bool useProjectCache = true,
  Map<String, String> environment = const {},
}) {
  console.detail('Running: dart ${arguments.join(' ')}');
  return processRunner.runInteractive(
    'dart',
    arguments,
    workingDirectory: workingDirectory ?? targetDirectory,
    environment: {
      if (useProjectCache) ...?project?.pubEnvironment,
      ...environment,
    },
  );
}