nextMajor property Null safety

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.


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

  return _incrementMajor();