minAppVersion method
Version?
minAppVersion(
- Document response, {
- String tagRegExpSource = r'\[\Minimum supported app version\:[\s]*(?<version>[^\s]+)[\s]*\]',
Return the minimum app version taken from a tag in the description field from the store response.
The tagRegExpSource
is used to represent the format of a tag using a regular expression.
The format in the description by default is like this: [Minimum supported app version: 1.2.3]
, which
returns the version 1.2.3
. If there is no match, it returns null.
Implementation
Version? minAppVersion(
Document response, {
String tagRegExpSource =
r'\[\Minimum supported app version\:[\s]*(?<version>[^\s]+)[\s]*\]',
}) {
Version? version;
try {
final desc = description(response);
if (desc != null) {
final regExp = RegExp(tagRegExpSource, 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: PlayStoreResults.minAppVersion: mav=$mav, tag=$tagRegExpSource, error=$e');
}
}
}
}
}
} on Exception catch (e) {
if (debugLogging) {
if (kDebugMode) {
print('upgrade.PlayStoreResults.minAppVersion : $e');
}
}
}
return version;
}