readPubspec static method
Read and parse pubspec.yaml file
Implementation
static Future<PubspecData> readPubspec() async {
final File file = File(FileConfig.pubspecFile);
if (!file.existsSync()) {
throw Exception('${FileConfig.pubspecFile} not found');
}
final String content = await file.readAsString();
final Map yaml =
Map<dynamic, dynamic>.from(loadYaml(content) ?? <dynamic, dynamic>{});
return PubspecData(
originalContent: content,
yaml: yaml,
);
}