Skip to content
pubscout

version

3.0.2, released 4 years ago by comstar.dev

Parses and compares semantic version numbers in compliance with http://semver.org/

WASM-ready
$ flutter pub add version
Source repository

What it does

Provides a Version object to parse, compare, and increment version numbers that follow the Semantic Versioning specification. It handles features like pre-release tags and comparison operators directly in Dart.

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

Use it when

  • You need to parse semantic version strings in your Dart or Flutter application
  • You need to compare different application or dependency versions
  • You want strict adherence to the http://semver.org/ specification

Skip it when

  • You specifically require the pub_semver package behavior which deviates from the standard semver spec in specific ways
  • You do not need version parsing or comparison utilities

Strengths

  • Compliant with the Semantic Versioning 2.0.0 specification
  • Supports pre-release and build validation
  • Simple and straightforward API with standard comparison operators

Weaknesses

  • Diverts from pub_semver which may be expected in some pub-related tooling

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

none

import 'package:version/version.dart';

void main() {
  Version currentVersion = new Version(1, 0, 3);
  Version latestVersion = Version.parse("2.1.0");

  if (latestVersion > currentVersion) {
    print("Update is available");
  }
}

Alternatives

Packages that do the same job and could replace version.

  • string_scanner

    A class for parsing strings using a sequence of patterns.

  • rrule

    Recurrence rule parsing, calculation, and formatting as defined in the iCalendar RFC.

  • japx

    Lightweight parser that flattens and builds JSON:API structures.

  • unicode

    Library providing Unicode character utilities and emoji data generated from Unicode 17.0.0

Works with

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