Skip to content
pubscout

pub_semver

2.2.1, released 3 months ago by tools.dart.dev

Versions and version constraints implementing pub's versioning policy.

WASM-readyRock solid
$ flutter pub add pub_semver
Source repository

What it does

Implements parsing, comparison, and constraint checking for semantic version numbers according to pub's specific versioning policy. It handles special pub corner cases like build suffix ordering and pre-release prioritization.

AI-written summary of version 2.2.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to parse and compare semantic version numbers in Dart
  • You are building tools that deal with pub-compatible package version constraints

Skip it when

  • You are looking for vanilla semver without pub's specific pre-release and build suffix policies

Strengths

  • Matches pub's exact versioning and constraint policy
  • Handles complex ranges, unions, and pre-release priority rules

Weaknesses

  • Not strictly compliant with vanilla SemVer 2.0.0 in certain corner cases due to pub-specific policies

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
import 'package:pub_semver/pub_semver.aspx';

void main() {
  var version = Version.parse('1.4.2');
  print(version.major);
}

Works with

Packages commonly used together with pub_semver: ones it builds on, ones built on it, and its own family.