resolve method
Implementation
Future<ResolvedVersion> resolve(
VersionConfig config, {
bool writeBack = true,
}) async {
final current = await _pubspecVersion();
final parts = current.split('+');
final currentName = parts.first;
final currentCode = parts.length > 1 ? parts[1] : '0';
final name = config.name == null || config.name!.trim().isEmpty
? currentName
: await variables.process(config.name);
final Object code = switch (config.codeSource) {
VersionCodeSource.pubspec => currentCode,
VersionCodeSource.increment => _increment(currentCode),
VersionCodeSource.gitCommits => await _gitCommitCount(),
VersionCodeSource.timestamp => _timestampCode(),
VersionCodeSource.literal => int.parse(config.code),
};
final result = ResolvedVersion(name: name, code: code.toString());
if (config.writeBack && writeBack) await this.writeBack(result);
return result;
}