dryRun static method

bool dryRun(
  1. dynamic fileOrPath, {
  2. int? lineLength,
})

Run the dartfmt command with the --dry-run option. Return true if any files would be changed by running the formatter.

Implementation

static bool dryRun(fileOrPath, {int? lineLength}) {
  try {
    _run(
      ['--output=none', '--set-exit-if-changed'],
      coerceToPathList(fileOrPath),
      lineLength: lineLength,
    );
    return false;
  } on ProcessException catch (e) {
    if (e.exitCode == 1) {
      return true;
    }
    rethrow;
  }
}