FLUTTER ECOSYSTEM

sanmadjack/version_dart

一个提供 Version 类的 Dart 库

版本 项目封面
Stars
46
Forks
13
最近推送(UTC)
2026年6月12日
项目状态
未归档
Matthew Barbour GitHub avatar
GITHUB User

Matthew Barbour ↗

Right here!官方网站 ↗
语言DartShell

使用的依赖

依赖清单 1 项
  • test开发依赖^1.16.3

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

展开 / 收起项目 README

version

version 3.0.2 Tests 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: ^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.