pathPubspecRemoveDependency function

Future<bool> pathPubspecRemoveDependency(
  1. String dir,
  2. String dependency
)

Returns true if removed

Implementation

Future<bool> pathPubspecRemoveDependency(String dir, String dependency) async {
  var map = await pathGetPubspecYamlMap(dir);
  if (pubspecYamlHasAnyDependencies(map, [dependency])) {
    var content = _loadPubspecContent(dir);
    content = pubspecStringRemoveDependency(content, dependency);
    await _writePubspecContent(dir, content);
    return true;
  }
  return false;
}