runFormatter static method

Future<bool> runFormatter(
  1. String directory, {
  2. bool printErrors = true,
})

Implementation

static Future<bool> runFormatter(String directory, {bool printErrors = true}) async {
  try {
    await run(
      'flutter',
      ["format", "."],
      workingDirectory: directory,
      printErrors: printErrors,
    );
    return true;
  } catch (e) {
    return false;
  }
}