explorePopularPlaces method

Future<Map<String, dynamic>> explorePopularPlaces({
  1. required double lat,
  2. required double lon,
  3. PopularPlacesCategory? category,
  4. int offset = 20,
})

exploreNearbyPlaces returns a List of popular places near the center of the lat and lon given category can be given to retrieve the popular places of particular category offset can be given to set the number of results returned by exploreNearbyPlaces By default the value of offset is set to 20 nextUrl can be given to fetch the next set of results

Implementation

Future<Map<String, dynamic>> explorePopularPlaces({
  required double lat,
  required double lon,
  PopularPlacesCategory? category,
  int offset = 20,
}) async {
  assert(offset >= 0, "offset can't be negative");

  final headers = _createHeader();
  final data = _createMap();

  data['at'] = '$lat,$lon';

  if (category != null) {
    final cat = EnumUtils.getName(category);
    data['cat'] = _categoryMap.containsKey(cat) ? _categoryMap[cat]! : cat;
  }

  data['size'] = offset.toString();
  data['tf'] = 'plain';

  var uri = Uri.https('places.ls.hereapi.com', '/places/v1/discover/explore', data);
  return _callHereApi(uri, headers);
}