fix static method

Future<void> fix([
  1. List<String>? paths,
  2. bool dryRun = false
])

Implementation

static Future<void> fix([List<String>? paths, bool dryRun = false]) async {
  final dryRunFlag = dryRun ? '--dry-run' : '--apply';

  if (paths == null || paths.isEmpty) {
    return execute(['${FlutterHelper.getCommandDart()} fix $dryRunFlag']);
  } else {
    for (var element in paths) {
      final isFile = File(element).existsSync();

      if (isFile) {
        await '${FlutterHelper.getCommandDart()} fix $dryRunFlag $element'
            .start(
          workingDirectory: '.',
        );
      } else {
        await '${FlutterHelper.getCommandDart()} fix $dryRunFlag'.start(
          workingDirectory: element,
        );
      }
    }
  }
}