lookupById method

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

Look up by id. Example: look up Google Maps iOS App: lookupURLById('585027354'); lookupURLById('585027354', country: 'FR');

Implementation

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

  final url =
      lookupURLById(id, country: country, useCacheBuster: useCacheBuster)!;
  if (debugEnabled) {
    print('upgrader: download: $url');
  }
  try {
    final response = await client!.get(Uri.parse(url));
    final decodedResults = _decodeResults(response.body);
    return decodedResults;
  } catch (e) {
    print('upgrader: lookupById exception: $e');
    return null;
  }
}