getPackageName method
Gets the package name from pubspec.yaml Throws StateError if not loaded or package name not found
Implementation
String getPackageName() {
if (_pubspecContent == null) {
throw StateError('Pubspec not loaded. Call load() first.');
}
final name = _pubspecContent!['name'];
if (name == null || name is! String) {
throw FormatException(
'Package name not found or invalid in pubspec.yaml',
);
}
return name;
}