declaredVersion property

String? get declaredVersion

The version: its pubspec declares, as written (quotes taken off); null when it declares none or it can't be read.

Implementation

String? get declaredVersion {
  try {
    final pubspec = File('$rootPath/pubspec.yaml');
    if (!pubspec.existsSync()) return null;
    return PubspecFields.version(pubspec.readAsStringSync());
  } on FileSystemException {
    return null;
  }
}