version 1.0.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 88

version

version 1.0.3 build status Coverage Status

A dart library providing a Version object for comparing and incrementing version numbers in compliance with the Semantic Versioning spec at http://semver.org/

This is in contrast to pub_semver, which is close to the spec but diverts in a few specific ways.

Installation

In your pubspec.yaml:

dependencies:
  version: ^1.0.0

Usage

A simple usage example:

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");
  }

  Version betaVersion = new Version(2, 1, 0, preRelease: ["beta"]);
  // Note: this test will return false, as pre-release versions are considered
  // lesser then a non-pre-release version that otherwise has the same numbers.
  if (betaVersion > latestVersion) {
    print("More recent beta available");
  }
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

1.0.3

  • Fixed analysis and formatting issues.
  • Enabled strong mode analysis.
  • Widened SDK version, verified 2.0 compatibility.
  • Updated URLs.
  • Simplified hashCode implementation.
  • Added code coverage support.

1.0.2

  • Additional pre-release and build validation.
  • Fixed/expanded some documentation text.
  • Additional tests for pre-release and build.

1.0.1

  • Changes for dartdoc building.

1.0.0

  • Initial release.

example/version_example.dart

// Copyright (c) 2017, Matthew Barbour. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:version/version.dart';

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

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

  final Version betaVersion =
      new Version(2, 1, 0, preRelease: <String>["beta"]);
  // Note: this test will return false, as pre-release versions are considered
  // lesser then a non-pre-release version that otherwise has the same numbers.
  if (betaVersion > latestVersion) {
    print("More recent beta available");
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  version: ^1.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:version/version.dart';
  
Version Uploaded Documentation Archive
1.0.3 Jun 14, 2018 Go to the documentation of version 1.0.3 Download version 1.0.3 archive
1.0.2 Mar 30, 2017 Go to the documentation of version 1.0.2 Download version 1.0.2 archive
1.0.1 Mar 30, 2017 Go to the documentation of version 1.0.1 Download version 1.0.1 archive
1.0.0 Mar 30, 2017 Go to the documentation of version 1.0.0 Download version 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
76
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
88
Learn more about scoring.

We analyzed this package on Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:version/version.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <3.0.0
Dev dependencies
test ^0.12.0