1

I am Using the PlacePicker Package for Flutter , the package has a parameter called

autocompleteComponents : A grouping of places to which you would like to restrict your results. Currently, you can use components to filter by up to 5 countries.

but I can't find anywhere how to use this parameter i can't initiate a list of components

4

1 回答 1

1

Found the Answer

import 'package:google_maps_webservice/places.dart' as google_maps_api;
...
PlacePicker(
apiKey: APIKeys.apiKey,   // Put YOUR OWN KEY here.
autocompleteComponents: [
    google_maps_api.Component("country", "fr") //restrict search results to France
],
onPlacePicked: (result) { 
    print(result.address); 
    Navigator.of(context).pop();
},
initialPosition: HomePage.kInitialPosition,
    useCurrentLocation: true,
),

source an example of how to use autocompleteComponents #111

于 2021-11-18T11:42:15.377 回答