addPackage static method
Add a package to your pubspec.yaml file.
Implementation
static addPackage(String package, {String? version, bool dev = false}) async {
String command = "dart pub add";
if (dev) {
command += " --dev";
}
command += " $package";
if (version != null) {
command += ":$version";
}
await runProcess(command);
}