version 1.0.2

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

version #

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

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

Use this package as a library

1. Depend on it

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


dependencies:
  version: ^1.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub 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
Awaiting analysis to complete.