puro function
Executes Flutter CLI via puro
Implementation
Future<ProcessCompletion> puro(
List<String> args, {
Directory? workingDirectory,
dcli.Progress? progress,
bool nothrow = false,
String Function()? throwOnError,
}) async {
final puroPath = getPuroPath();
if (puroPath == null) {
throw PuroNotFoundException();
}
int exitCode = -1;
try {
final process = dcli.startFromArgs(
puroPath.path,
['--no-update-check', '--no-install', ...args],
workingDirectory: workingDirectory?.absolute.path,
nothrow: nothrow || throwOnError != null,
progress: progress,
terminal: progress == null,
);
exitCode = process.exitCode ?? -1;
} catch (e) {
if (e is dcli.RunException) {
exitCode = e.exitCode ?? 1;
}
if (throwOnError == null) {
rethrow;
}
}
if (exitCode != 0 && throwOnError != null) {
throw throwOnError();
}
return ProcessCompletion(exitCode: exitCode);
}