fixTemplatePubspec function
- @visibleForTesting
update the templates dcli version to match the dcli version the user is running. @Throwing(PubSpecException)
Implementation
@visibleForTesting
void fixTemplatePubspec(
String projectName, PubSpec pubSpec, String pathToPubSpec) {
final current = pubSpec.dependencies;
if (current.exists('dcli')) {
final dcli = current['dcli'];
if (dcli is DependencyVersioned) {
(dcli! as DependencyVersioned).versionConstraint = packageVersion;
}
}
pubSpec
..name.set(_replaceInvalidCharactersForName(projectName))
..saveTo(pathToPubSpec);
}