nextPreRelease property

Version get nextPreRelease

Returns a new instance of Version with the next pre-release:

  • pre-release with a non-numeric last segment gets .1 appended: 1.2.3-foo42 -> 1.2.3-foo42.1
  • pre-release with a numeric last segment gets the last segment incremented: 1.2.3-foo.1.2.3 -> 1.2.3-foo.1.2.4
  • empty pre-release can not be incremented. Throws a StateError

Implementation

Version get nextPreRelease {
  if (preRelease.isEmpty) throw StateError('Can not bump empty pre-release');
  return change(preRelease: preRelease.next, build: []);
}