buildNumberAsInt property

int? get buildNumberAsInt

buildNumber read as an integer, or null when it is not one.

The form to compare and to order by. A build number is a string here because CFBundleVersion is one and Apple will accept 1.2.3, but comparing two of them as strings is wrong the moment they differ in width: "9" sorts above "10". That mistake has now been made twice against this data — once inside this package, where the build listing trusted Apple's lexical sort=-version while build-number sorted numerically beside it, and once in a consumer comparing AppStoreBuilds.newestBuildNumber against an integer out of a git tag. Both were invisible while every build number had the same number of digits, and both would have surfaced at 1000.

Null rather than a fallback, so a version string that is not a single integer is a case the caller has to answer rather than one silently ordered as zero.

Implementation

int? get buildNumberAsInt => int.tryParse(buildNumber);