removeDependencies static method

void removeDependencies(
  1. String package, {
  2. bool isDev = false,
  3. bool logger = true,
})

Implementation

static void removeDependencies(String package,
    {bool isDev = false, bool logger = true}) {
  if (logger) LogService.info('Removing package: "$package"');

  if (containsPackage(package, isDev)) {
    var dependencies = pubSpec.dependencies;
    var devDependencies = pubSpec.devDependencies;

    dependencies.removeWhere((key, value) => key == package);
    devDependencies.removeWhere((key, value) => key == package);
    var newPub = pubSpec.copy(
      devDependencies: devDependencies,
      dependencies: dependencies,
    );
    _savePub(newPub);
    if (logger) {
      LogService.success(
          LocaleKeys.success_package_removed.trArgs([package]));
    }
  } else if (logger) {
    LogService.info(LocaleKeys.info_package_not_installed.trArgs([package]));
  }
}