runShell method

Future<void> runShell(
  1. String command, {
  2. String? workingDir,
})

Runs a shell command in the project directory with structured logging and exception contextualization.

Implementation

Future<void> runShell(String command, {String? workingDir}) async {
  Logger.info('Running shell command: `$command`');
  try {
    await Shell(
      workingDirectory: workingDir ?? projectDir,
    ).run(command);
  } catch (e, s) {
    throw BuildException(
      'Failed to execute command: `$command`',
      fix:
          'Review the terminal logs above to see specific output from Flutter/Dart tools.',
      originalStackTrace: s,
    );
  }
}