removeFromDependencies method
void
removeFromDependencies(
- String dependence
)
Implementation
void removeFromDependencies(String dependence) {
final fieldLineInd = indexWhere((element) => element.contains(dependence));
if (fieldLineInd == -1) {
return;
}
// Check whether this is the only dependency
if (fieldLineInd - 1 != -1 &&
this[fieldLineInd - 1].endsWith('dependencies {') &&
fieldLineInd + 1 != length &&
this[fieldLineInd + 1].endsWith('}')) {
if (fieldLineInd - 2 != -1 && this[fieldLineInd - 2].isEmpty) {
removeRange(fieldLineInd - 2, fieldLineInd + 2);
} else {
removeRange(fieldLineInd - 1, fieldLineInd + 2);
}
} else {
removeAt(fieldLineInd);
}
}