getVersion method

String? getVersion()

Gets the package version from pubspec.yaml

Implementation

String? getVersion() {
  if (_pubspecContent == null) {
    throw StateError('Pubspec not loaded. Call load() first.');
  }

  final version = _pubspecContent!['version'];
  return version?.toString();
}