Google 在 Flutter 中排名 API

Google Places API in Flutter

我正在使用 Flutter 在 google 个地方 API 上工作。我正在参考 工作。但是我得到了 google 地方 API 类 作为

的错误

例如:

Undefined class 'GoogleMapsPlaces'. Try changing the name to the name of an existing class, or creating a class with the name

我在我的飞镖文件中导入了 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 地方找到另一个包 google_place

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

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