GetByText method
Implementation
@override
Future<dynamic> GetByText({String? text}) async {
Response returnResponse;
try {
Map<String, String> headers = {"Accept-Language": "en-US"};
String url = "${Configuration.GeoCodingSource.OSMConfig.NominatimURL!}/search?q=$text&countrycodes=${Configuration.GeoCodingSource.OSMConfig.CountryCode??"bd"}";
http.Response response = await http
.get(Uri.parse(url), headers: headers)
.timeout(
const Duration(seconds: 60),
onTimeout: () {
throw FetchDataException('Request timeout');
},
);
returnResponse = Response(
_returnResponse(response), response.statusCode, response.headers);
} on SocketException {
throw FetchDataException('No Internet connection');
}
return returnResponse;
}