lookupByBundleId method

Future<Map?> lookupByBundleId(
  1. String bundleId, {
  2. String? country = 'US',
  3. bool useCacheBuster = true,
})

Look up by bundle id. Example: look up Google Maps iOS App: lookupURLByBundleId('com.google.Maps'); lookupURLByBundleId('com.google.Maps', country: 'FR');

Implementation

Future<Map?> lookupByBundleId(String bundleId,
    {String? country = 'US', bool useCacheBuster = true}) async {
  assert(bundleId.isNotEmpty);
  if (bundleId.isEmpty) {
    return null;
  }

  final url = lookupURLByBundleId(bundleId,
      country: country ??= '', useCacheBuster: useCacheBuster)!;
  if (debugEnabled) {
    print('upgrader: download: $url');
  }

  try {
    final response = await client!.get(Uri.parse(url));
    if (debugEnabled) {
      print('upgrader: response statusCode: ${response.statusCode}');
    }

    final decodedResults = _decodeResults(response.body);
    return decodedResults;
  } catch (e) {
    print('upgrader: lookupByBundleId exception: $e');
    return null;
  }
}