readPubspecVersion function
Reads the version from the pubspec.yaml file
Implementation
Version? readPubspecVersion(File pubspecFile) {
if (!pubspecFile.existsSync()) {
error('pubspec.yaml not found at ${pubspecFile.absolute.path}');
}
final pubSpec = PubSpec.fromFile(pubspecFile.absolute.path);
return pubSpec.version;
}