readPubspec method
Implementation
Future<YamlMap?> readPubspec(String projectPath) async {
try {
final pubspecFile = File(path.join(projectPath, 'pubspec.yaml'));
if (!await pubspecFile.exists()) {
throw AssetOptException('pubspec.yaml not found in $projectPath');
}
final content = await pubspecFile.readAsString();
return loadYaml(content) as YamlMap;
} on YamlException catch (e) {
throw AssetOptException('Invalid pubspec.yaml: ${e.message}');
} catch (e) {
throw AssetOptException('Failed to read pubspec.yaml: $e');
}
}