如何在扑朔迷离中添加Google Maps自动填充搜索框?
我想使用dart在Google地图中添加自动填充搜索框。
答案 0 :(得分:0)
在pubspec.yaml中添加依赖项
flutter_google_places:
之后,您可以使用此方法
Future<void> _handlePressButton() async {
// show input autocomplete with selected mode
// then get the Prediction selected
Prediction p = await PlacesAutocomplete.show(
context: context,
apiKey: 'your_api_key',
// onError: onError,
mode: Mode.overlay,
language: "en",
components: [Component(Component.country, "in")],
);
}