I'm using the flutter_google_places widget to search for cities.
I've tried the AutoComplete example given with the widget and it works perfectly. But when I type "Paris" for example, I get many results of places in Paris (Paris, Paris Airport, Paris Expo, etc.).
I only need cities within my App. So for example, when typing "Paris", I would only want "Paris (France), Paris (Texas), Paris (Tennessee), etc.
I haven't found how to apply the "cities" filter.
Here is the equivalent in Javascript :
var input = document.getElementById('searchField');
var options = {
types: ['(cities)']
};
autocomplete = new google.maps.places.Autocomplete(input, options);
Any idea?
If you are using this example: https://github.com/fluttercommunity/flutter_google_places/blob/master/example/lib/main.dart
Should do
CustomSearchScaffold()
: super(
apiKey: kGoogleApiKey,
sessionToken: Uuid().generateV4(),
language: "en",
components: [Component(Component.country, "uk")],
types: ["(cities)"], // or cities
);