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 (debugLogging) {
    if (kDebugMode) {
      print('hcUpgrade: download: $url');
    }
  }
  try {
    final response = await client!.get(Uri.parse(url));
    final decodedResults = _decodeResults(response.body);
    return decodedResults;
  } catch (e) {
    if (debugLogging) {
      if (kDebugMode) {
        print('hcUpgrade: lookupById exception: $e');
      }
    }
    return null;
  }
}