version 1.0.2

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

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

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

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or 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.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

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
68 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
84

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

  • Enable strong mode analysis.

    Strong mode helps you to detect bugs and potential issues earlier.Start your analysis_options.yaml file with the following:

    analyzer:
      strong-mode: true
    

Dependencies

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