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

套件詳情v1.1.1

flutter_google_maps_webservices

適用於 Flutter 的 Google 地圖 Web 服務(地理編碼、地點、路線、距離矩陣、照片、時區、靜態地圖)

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1.7萬
喜歡數
27
Pub 分數
150

安裝套件

flutter pub add flutter_google_maps_webservices

套件介紹

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

一個 Flutter 套件,提供對 Google Maps Web Services 的存取,讓開發者能夠將地理編碼、地點搜尋、路線規劃、距離矩陣、照片取得、時區資訊以及靜態地圖等功能整合至其應用程式中。此套件支援多個平台,包含 Android、iOS、Web、macOS、Windows 與 Linux。該套件透過乾淨的 Dart 界面簡化 API 互動,讓開發者無需手動管理 HTTP 請求即可輕鬆取得地圖相關資料。非常適合需要位置智慧與地圖功能的應用程式。

適用情境

  • 將地址轉換為座標
  • 搜尋附近地點
  • 計算路線和出行方向
  • 獲取位置之間的距離和時長
  • 顯示靜態地圖影像
  • 根據位置獲取時區詳細資訊

主要特色

  • 支援所有主要的 Google 地圖 Web 服務
  • 跨平台相容性
  • 簡單直覺的 Dart API
  • 內建錯誤處理
  • 非同步請求管理
  • 輕量且易於整合

適合對象

  • 位置感知應用
  • 旅行和導航應用
  • 房地產和房產經紀人
  • 配送和物流服務
  • 旅遊和發現平台
  • 任何需要地圖數據整合的應用程式

使用建議

  • 需要一個 Google Cloud Platform API 金鑰
  • 根據使用層級應用速率限制
  • 高使用量可能會產生額外費用
  • 所有操作都需要互聯網連接
  • API 密鑰必須在生產環境中受到保護

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

flutter_google_maps_webservices

Build Status codecov Star on Github Buy Me A Coffee

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:flutter_google_maps_webservices/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:flutter_google_maps_webservices/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:flutter_google_maps_webservices/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.

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案