搜尋套件、儲存庫與 APP 分類

套件詳情v0.0.19

google_maps_webservice

Google 地圖 Web 服務 [API](https://developers.google.com/maps/web-services)

近 30 天下載
9700
喜歡數
163
Pub 分數
30

安裝套件

flutter pub add google_maps_webservice

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

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 原文快照,最新內容請造訪原始碼儲存庫。

Build Status codecov Star on Github Buy Me A Coffee

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.

Availables API

Usage

Geocoding
import "package:google_maps_webservice/geocoding.dart";

final geocoding = GoogleMapsGeocoding(apiKey: "<API_KEY>");
final geocoding = GoogleMapsGeocoding(apiKey: "<API_KEY>", httpClient: BrowserClient());
final geocoding = GoogleMapsGeocoding(baseUrl: "http://myProxy.com");

GeocodingResponse response = await geocoding.searchByAddress("1600 Amphitheatre Parkway, Mountain View, CA");
Places
import "package:google_maps_webservice/places.dart";

final places = GoogleMapsPlaces(apiKey: "<API_KEY>");
final places = GoogleMapsPlaces(apiKey: "<API_KEY>", httpClient: BrowserClient());
final places = GoogleMapsPlaces(baseUrl: "http://myProxy.com");

PlacesSearchResponse response = await places.searchNearbyWithRadius(Location(lat: 31.0424, lng: 42.421), 500);
PlacesSearchResponse response = await places.searchNearbyWithRankby(Location(lat: 31.0424, lng: 42.421), "distance");
PlacesSearchResponse response = await places.searchByText("123 Main Street");

PlacesDetailsResponse response = await places.getDetailsByPlaceId("PLACE_ID");
PlacesDetailsResponse response = await places.getDetailsByReference("REF");
Timezone
import "package:google_maps_webservice/timezone.dart";

final timezone = GoogleMapsTimezone(apiKey: "<API_KEY>");
final timezone = GoogleMapsTimezone(apiKey: "<API_KEY>", httpClient: BrowserClient());
final timezone = GoogleMapsTimezone(baseUrl: "http://myProxy.com");

TimezoneResponse response = await timezone.getByLocation(Location(lat: 31.0424, lng: 42.421));
TimezoneResponse response = await timezone.getByLocation(Location(lat: 31.0424, lng: 42.421), timestamp: DateTime.utc(2019, 4, 24));
TimezoneResponse response = await timezone.getByLocation(Location(lat: 31.0424, lng: 42.421), timestamp: DateTime.utc(2019, 4, 24), language: 'es');
Static Map

  StaticMap mapStatic = StaticMap(
    apiKey,
    markers: List.from([
      Location(lat: 23.721160, lng: 90.394435),
      Location(lat: 23.732322, lng: 90.385142),]
    ),
    path: Path(
      enc: 'svh~F`j}uOusC`bD',
      color: 'black',
    ),
    scale: 'false'
  )

  String url = mapStatic.getUrl();

  Image.network(url)


Proxy

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.

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案