copyWith method

Version copyWith({
  1. int? major,
  2. int? minor,
  3. int? patch,
  4. String? pre = _undefined,
  5. String? build = _undefined,
})

Implementation

Version copyWith({
  int? major,
  int? minor,
  int? patch,
  String? pre = _undefined,
  String? build = _undefined,
}) {
  return Version(
    major ?? this.major,
    minor ?? this.minor,
    patch ?? this.patch,
    pre: pre == _undefined
        ? (preRelease.isNotEmpty
            ? preRelease.map((p) => p.toString()).join('.')
            : null)
        : pre,
    build: build == _undefined
        ? (this.build.isNotEmpty
            ? this.build.map((b) => b.toString()).join('.')
            : null)
        : build,
  );
}