繁体   English   中英

Flutter 中的 Google Places API

[英]Google Places API in Flutter

我正在使用 Flutter 开发谷歌地点 API。 我正在通过引用示例来工作 但是我遇到了 google 将 API 类设置为的错误

例如:

未定义的类“GoogleMapsPlaces”。 尝试将名称更改为现有类的名称,或使用该名称创建类

我在我的 dart 文件中导入了flutter_google_places为:

import 'package:flutter_google_places/flutter_google_places.dart'; 但是我仍然收到所有课程的错误。

使用flutter_google_places版本0.2.3

在此处输入图片说明

GoogleMapPlaces 在不同的图书馆中可用,而不是在 flutter_google_places ...

它在https://pub.dev/packages/google_maps_webservice上可用

你可以为 google place google_place找到另一个包

var googlePlace = GooglePlace("Your-Key");
var result = await googlePlace.autocomplete.get("1600 Amphitheatre");

您需要导入import 'package:google_maps_webservice/places.dart'; 在你的 main.dart 中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM