reverseSearch method
Future<List<PhotonFeature> >
reverseSearch(
- double latitude,
- double longitude, {
- bool secure = true,
- PhotonReverseParams params = const PhotonReverseParams(),
Does a reverse search at the given latitude
and longitude
.
Returns an empty list if there are no results near the given location.
The search can be improved or further influenced by specifying a set of params
.
If secure
is set to false, requests will be performed via HTTP, otherweise HTTPS is used (default).
Throws an exception if the API response has a status code different than 200.
Implementation
Future<List<PhotonFeature>> reverseSearch(double latitude, double longitude,
{bool secure = true,
PhotonReverseParams params = const PhotonReverseParams()}) async {
var queryParams = params.buildQueryParameters();
queryParams['lon'] = '$longitude';
queryParams['lat'] = '$latitude';
final uri = secure
? Uri.https(
_baseUri.authority, _baseUri.path + _reverseEndpoint, queryParams)
: Uri.http(
_baseUri.authority, _baseUri.path + _reverseEndpoint, queryParams);
final res = await http.get(uri);
return _handleResponse(res);
}