google_maps_webservice 包提供了一个 Dart 客户端,用于与 Google Maps Web Services API 进行交互。它使 Flutter 应用能够通过 HTTP 请求访问地理编码、地点、路线、距离矩阵以及其他地图相关数据。该包专为需要程序化访问 Google 地图基础设施的开发者设计,简化了集成过程,无需直接管理 API 调用。该包轻量且专注于核心 Web 服务功能,非常适合在 Flutter 应用中进行类似后端的操作。
适合场景
将地址转换为坐标
获取附近地点和详细信息
计算路线和旅行距离
将地图数据集成到基于位置的功能中
在无服务器函数中处理地图数据
主要特点
Google Maps API 的简单 HTTP 客户端
支持多个 Google Maps Web 服务
干净、类型安全的请求和响应模型
与 Flutter 应用轻松集成
文档齐全且持续维护
适合对象
开发位置感知的 Flutter 应用程序的开发者
需要从 Google Maps Web Services 获取地图数据的应用程序
需要地理编码或路线计算的项目
Flutter 应用中的后端逻辑
大量使用 Google 地图 API 的团队
使用建议
需要有效的 Google Cloud API 密钥
不包含地图UI渲染(请与 google_maps_flutter 一起使用)
仅限网页服务端点,不支持实时地图
根据 Google Cloud 计费应用速率限制
不适用于离线地图功能
原始 README
以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。
google_maps_webservice
General Information
This is the Dart Library for Google Maps Webservices.
You can find the Google Maps Platform Documentation here, but if you're new to this, you may want to start here.
API Key
To use this library you need a Web API key. Follow these steps to acquire the key relevant to your particular Dart application.
These keys are not to be used individually as Android or iOS API keys, but they are instead meant to be used in your Dart application.
In case of using a proxy the baseUrl can be set.
The apiKey is not required in case the proxy sets it. (Not storing the apiKey in the app is good practice)
Feature Requests and Issues
Please file feature requests and bugs at the issue tracker.