flutterClean method

Future<int> flutterClean()

Implementation

Future<int> flutterClean() async {
  logger.logCommand('flutter clean');
  if (dryRun) return 0;
  final Process process;
  try {
    process = await Process.start(
      'flutter',
      ['clean'],
      workingDirectory: projectRoot.path,
      runInShell: true,
      includeParentEnvironment: true,
    );
    JobArguments.trackProcess(process);
  } on ProcessException catch (error) {
    logger.logError('Unable to start `flutter clean`: ${error.message}');
    return 127;
  }
  final drained = Future.wait([
    process.stdout.transform(utf8.decoder).forEach(logger.logDebug),
    process.stderr.transform(utf8.decoder).forEach(logger.logErrorVerbose),
  ]);
  final exit = await process.exitCode;
  await drained;
  return exit;
}