lookupById method
Look up by id.
Implementation
Future<Document?> lookupById(String id,
{String? country = 'US',
String? language = 'en',
bool useCacheBuster = true}) async {
assert(id.isNotEmpty);
if (id.isEmpty) return null;
final url = lookupURLById(id,
country: country, language: language, useCacheBuster: useCacheBuster)!;
if (debugLogging) {
if (kDebugMode) {
print('hcUpgrade: lookupById url: $url');
}
}
try {
final response = await client!.get(Uri.parse(url));
if (response.statusCode < 200 || response.statusCode >= 300) {
if (debugLogging) {
if (kDebugMode) {
print(
'hcUpgrade: Can\'t find an app in the Play Store with the id: $id');
}
}
return null;
}
final decodedResults = _decodeResults(response.body);
return decodedResults;
} on Exception catch (e) {
if (debugLogging) {
if (kDebugMode) {
print('hcUpgrade: lookupById exception: $e');
}
}
return null;
}
}