copy method Null safety
Creates a copy of this version overriding the old values
Implementation
Version copy({
int? major,
int? minor,
int? patch,
String? preRelease,
String? build,
String? text,
}) {
String? currentBuild = this.build.join().trim();
if (currentBuild.isEmpty) {
currentBuild = build;
}
String? currentPre = this.preRelease.join().trim();
if (currentPre.isEmpty) {
currentPre = preRelease;
}
return Version(
major ?? this.major,
minor ?? this.minor,
patch ?? this.patch,
pre: preRelease ?? currentPre,
build: build ?? currentBuild,
);
}