简体   繁体   中英

How to get a Google Place using a placeId on Flutter?

I'm trying to find a function that would allow me to get a Google Place only using a placeId (and the apiKey of course).

I found the function GeoDataClient.getPlaceById(placeId) but unfortunately this doesn't seem to be available on Flutter. I am currently using the flutter_google_places dart package but am open to using something different if necessary.

I can't find one. It seems like something of a large gap in the ecosystem -- if you store a Google Place ID in your local database, you should be able to convert that into a place name and a location when you reload it.

The iOS equivalent of GeoDataClient is the Places SDK for iOS: https://developers.google.com/places/ios-sdk/intro .

I may write a plugin for this and add it to pub.dev. Unless you've found a better solution since you posted this question, this seems like the best available approach at the moment.

With that said, however, connecting to the Google Places SDK requires a network connection, so if you want optimal performance, you should try to keep invocations of the SDK bridge to a bare minimum, and ideally keep place details in a local SQLite database. This way, users will only be invoking the SDK bridge after loading the app on a new device.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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