version 3.0.2 copy "version: ^3.0.2" to clipboard
version: ^3.0.2 copied to clipboard

Provides a simple class for parsing and comparing semantic versions as defined by http://semver.org/

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");
  }
}
228
likes
120
pub points
99%
popularity

Publisher

verified publisherdart.ninja

Provides a simple class for parsing and comparing semantic versions as defined by http://semver.org/

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

More

Packages that depend on version