pubVersion property

String? get pubVersion

(only valid if isPubRef) gets the package version from the pub ref

Implementation

String? get pubVersion {
  if (!isPubRef) {
    return null;
  }
  final uri = Uri.parse(ref);
  final path = uri.path.replaceAll('/', '');
  if (path.isEmpty) {
    return null;
  }
  return path;
}