minAppVersion method
Return the minimum app version taken from the tag in the description field
from the store response. The format is: :mav: 1.2.3
.
Returns version, such as 1.2.3, or null.
Implementation
Version? minAppVersion(Map response, {String tagName = 'mav'}) {
Version? version;
try {
final desc = description(response);
if (desc != null) {
String regExpSource = r"\[\:tagName\:[\s]*(?<version>[^\s]+)[\s]*\]";
regExpSource = regExpSource.replaceAll(RegExp('tagName'), tagName);
final regExp = RegExp(regExpSource, caseSensitive: false);
final match = regExp.firstMatch(desc);
final mav = match?.namedGroup('version');
if (mav != null) {
try {
// Verify version string using class Version
version = Version.parse(mav);
} on Exception catch (e) {
if (debugLogging) {
if (kDebugMode) {
print(
'hcUpgrade: ITunesResults.minAppVersion: $tagName error: $e');
}
}
}
}
}
} on Exception catch (e) {
if (debugLogging) {
if (kDebugMode) {
print('upgrade.ITunesResults.minAppVersion : $e');
}
}
}
return version;
}