addressSuggestion function
Implementation
Future<List<SearchInfo>> addressSuggestion(String searchText,
{int limitInformation = 5}) async {
Response response = await Dio().get(
// "http://maps.google.com/maps?q=jhojhu" //working
//'https://maps.googleapis.com/maps/api/place/findplacefromtext/output?parameters', //
"https://photon.komoot.io/api/",
// "https://maps.googleapis.com/maps/api/place/textsearch/json?query=123%20main%20street&key=YOUR_API_KEY",
// queryParameters: {
// "query": searchText,
// "key": YOUR_API_KEY,
// },
queryParameters: {
"q": searchText,
"limit": limitInformation == 0 ? "" : "$limitInformation"
},
);
final json = response.data;
return (json["features"] as List)
.map((d) => SearchInfo.fromPhotonAPI(d))
.toList();
}