VersionUtils class

版本号比较工具

提供点分十进制版本号(如 1.2.0)的通用三态比较与「服务端是否更新」 便捷判断。吸收自 saas_pos 收银端同名能力并按本库基线重写: 非法输入抛 ArgumentError(原实现静默返回 false),仅纯数字段 参与数值比较——非纯数字段整段视为 0(不解析预发布标签, 1.0.0-beta 与 1.0.0 视为相等;带符号段 -1 / +1 亦视为 0), 纯数字但溢出 int 范围的段同样视为 0。

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

compare(String a, String b) → int
比较两个版本号,返回 a 相对 b 的顺序: -1(a 更旧)、0(相等)、1(a 更新)。
isNewer({required String serverVersion, required String clientVersion}) → bool
判断服务端版本 serverVersion 是否高于客户端版本 clientVersion。