google_places_flutter
google_places_flutter copied to clipboard
How to switch this to multiple country ?
Hello, @yshean your code is working fine. I added my own API key and it's working but it shows only Switzerland country location. why ?. I want to show multiple country locations so how to implement this? can you please help
In line 49/50 on file google_places_flutter/lib/place_service.dart you can set the property country.
Change
final request = 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=$input&types=address&language=$lang&components=country:ch&key=$apiKey&sessiontoken=$sessionToken';
to
final request = 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=$input&key=$apiKey&sessiontoken=$sessionToken';
Then you can search in multi languages and find places all over the world.
@dospringer 's answer will allow you to search every country available, for language - if it's not specified, then it will attempt to use the native language of the domain from which the request is sent. See the list of supported languages here