getProjectName method
Returns the project name from pubspec.yaml.
Implementation
String getProjectName() {
final pubspecFile = File(p.join(_projectDir, 'pubspec.yaml'));
if (!pubspecFile.existsSync()) return 'app';
final content = pubspecFile.readAsStringSync();
final match = RegExp(
r'^name:\s*(.+)$',
multiLine: true,
).firstMatch(content);
return match?.group(1)?.trim() ?? 'app';
}