version
v3.0.2Provides a simple class for parsing and comparing semantic versions as defined by http://semver.org/
Package archive: https://pubdev.letsnova.ru/api/archives/version/3.0.2.tar.gz
Install
dart pub add versionReadme
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/
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: ^3.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
Changelog
3.0.1-3.0.2
- Updated readme
3.0.0
- Changed parse function to not accept a null value
2.0.3
- Reverted 2.0.1 and 2.0.2 to prevent breaking dependents
2.0.2
- Changes for static analysis
2.0.1
- Changed parse function to not accept a null value
2.0.0
- Updated to comply with Dart null safety
1.3.0
- Added isPreRelease
- Added incrementPreRelease
1.2.1
- Formatting pass
1.2.0
- Added support for version 0.0.0
1.1.1-1.1.3
- Resolved code analysis hints
1.1.0
- Implemented Comparable<Version> interface
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.
