getProjectName function
Implementation
String getProjectName(String projectPath) {
final pubspecFile = File(p.join(projectPath, 'pubspec.yaml'));
if (!pubspecFile.existsSync()) return 'project_name';
final content = pubspecFile.readAsStringSync();
final match = RegExp(r'^name:\s+(.+)$', multiLine: true).firstMatch(content);
return match?.group(1)?.trim() ?? 'project_name';
}