getPubspecInfo function
- String fieldName
Implementation
String? getPubspecInfo(String fieldName) {
try {
String currentDirectory = Directory.current.path;
String pubspecPath = '$currentDirectory/pubspec.yaml';
File pubspecFile = File(pubspecPath);
String contents = pubspecFile.readAsStringSync();
var yaml = loadYaml(contents);
return yaml[fieldName];
} catch (e) {
print('Error reading pubspec.yaml: $e');
return null;
}
}