runPub method Null safety

  1. @protected
Future<ProcessResult> runPub(
  1. String cmd,
  2. List<String> arguments,
  3. {bool immediatePrintStd = true,
  4. bool immediatePrintErr = true,
  5. String? workingDir,
  6. bool prependWithPubGet = false}
)

Runs flutter pub run command.

Implementation

@protected
Future<ProcessResult> runPub(String cmd, List<String> arguments,
    {bool immediatePrintStd = true,
    bool immediatePrintErr = true,
    String? workingDir,
    bool prependWithPubGet = false}) async {
  if (prependWithPubGet) {
    final pubGetRes = await pub('get',
        workingDir: workingDir,
        immediatePrintStd: immediatePrintStd,
        immediatePrintErr: immediatePrintErr);

    if (pubGetRes.exitCode != 0) return pubGetRes;
  }

  return pub('run',
      arguments: [cmd, ...arguments],
      workingDir: workingDir,
      immediatePrintStd: immediatePrintStd,
      immediatePrintErr: immediatePrintErr);
}