loadPubspecFile static method
读取 pubspec.yaml
Implementation
static List<String> loadPubspecFile() {
final file = File('pubspec.yaml');
final content = file.readAsStringSync();
final versionMatch = RegExp(r'version:\s*([\d\.]+\+\d+)').firstMatch(content);
final projectMatch = RegExp(r'project:\s*(\w+)').firstMatch(content);
if (versionMatch == null) throw Exception('Version not found in pubspec.yaml');
if (projectMatch == null) throw Exception('Project not found in pubspec.yaml');
final version = versionMatch.group(1)!;
final project = projectMatch.group(1)!;
return [version, project];
}