formatDartFiles function

void formatDartFiles()

Format the selected dart folder with dartfmt if available.

Implementation

void formatDartFiles() {
  /// format dart files.
  if (config.validTranslationFile || config.validTKeyFile) {
    var lineLength = '';
    if (config.dartFormatLineLength > 0) {
      lineLength = '--line-length ${config.dartFormatLineLength}';
    }
    final cmd = 'dart format --fix $lineLength ${config.dartOutputDir}';

    print('running dart format...');
    print(cmd);
    if (which('dart').found) {
      cmd.start(
        // workingDirectory: config.dartOutputDir,
        detached: true,
        runInShell: true,
      );
    }
  }
}