getResultsByQuery method

Future<List<Feature>> getResultsByQuery(
  1. LatLng proximity,
  2. String query
)

Implementation

Future<List<Feature>> getResultsByQuery(
    LatLng proximity, String query) async {
  if (query.isEmpty) return [];
  final String url = '${Environment.placesBaseUrl}/$query.json';
  final resp = await _dioPlaces.get(url, queryParameters: {
    'proximity': '${proximity.longitude},${proximity.latitude}',
    'limit': 6
  });

  final PlacesResponse placesResponse = PlacesResponse.fromJson(resp.data);

  return placesResponse.features;
}