nextMajor property

Version nextMajor

Gets the next major version number that follows this one.

If this version is a pre-release of a major version release (i.e. the minor and patch versions are zero), then it just strips the pre-release suffix. Otherwise, it increments the major version and resets the minor and patch.

Implementation

Version get nextMajor {
  if (isPreRelease && minor == 0 && patch == 0) {
    return Version(major, minor, patch);
  }

  return _incrementMajor();
}