resolveVersion function
Version
resolveVersion({})
Implementation
Version resolveVersion({
required Version? pubspecVersion,
required String? appVersion,
required String? buildVersion,
required String? buildPreRelease,
required String? buildMetadata,
}) {
Version version;
if ((appVersion == null || appVersion.isEmpty) &&
(buildVersion == null || buildVersion.isEmpty)) {
version = pubspecVersion ?? Version(0, 0, 1);
} else if (buildVersion != null && buildVersion.isNotEmpty) {
version = Version.parse(buildVersion);
} else {
version = Version.parse(appVersion!.replaceFirst('v', ''));
}
if (buildPreRelease != null) {
version = version.copyWith(pre: buildPreRelease);
}
if (buildMetadata != null) {
version = version.copyWith(build: buildMetadata);
}
return version;
}