適用於 Windows 的 Flutter 插件實作,用於 Google Places SDK,讓開發者能將 Google 的地點搜尋與自動補完功能整合至 Windows 應用程式。它可讓使用者發現地點、取得地點詳細資料,並在執行於 Windows 上的 Flutter 應用中直接進行地理編碼。此套件設計為與廣泛的 Flutter 生態系統無縫運作,並利用原生 Windows 功能以達成最佳效能。
適用情境
在 Windows 桌面應用程式中整合地點自動完成
使用 Google Places API 搜尋位置
在 Windows 應用程式中顯示位置建議
透過即時地點預測提升使用者體驗
為 Windows 建構旅遊或物流應用
主要特色
原生 Windows 平台整合
支援地點自動補全與詳細資訊檢索
與 Flutter 的跨平台工作流程相容
在底層使用 Google Places API
輕量且易於設定
適合對象
使用位置功能開發 Windows 桌面應用的開發者
在 Windows 上需要 Google Places 功能的應用程式
針對多平台部署的Flutter團隊
使用建議
需要設定 Google Places API 金鑰
僅限 Windows 平台
依賴網路連線進行API呼叫
生產部署可能需要額外的設定
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
flutter_google_places_sdk
A Flutter plugin for google places sdk that uses the native libraries on each platform.
Check out Rational below to understand why you should use this plugin.
Location restriction is not supported. See google issue tracker for more info: https://issuetracker.google.com/issues/36219203
Rational
By now you probably found some other plugins, and wondering why this one was even created.
Well, there's a good reason for that.
All other plugins will use http web requests rather than the native sdk.
Google allows you to limit the usage of your api key to your android application.
However, that only works when you're using the native SDK.
So when using the http web requests method, you can't actually limit it,
and if someone can get your API key (usually not a problem if it's in a mobile client),
it can be used anywhere outside of it.
Example
import'package:flutter/material.dart';
import'package:flutter_google_places_sdk/flutter_google_places_sdk.dart';
voidmain() {
runApp(MaterialApp(
home: Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () async {
final places = FlutterGooglePlacesSdk('my-key');
final predictions =
await places.findAutocompletePredictions('Tel Aviv');
print('Result: $predictions');
},
child: Text('Predict and print to console'),
),
),
),
));
}
Development & Contributing
This is a side project of mine, hence issues are usually dealt with on weekends.
PRs are more than welcome if anyone want to contribute. There are
Contribution Guidelines
General code quality will adhere to new PRs, although nothing too strict. Specifics will discussed in each PRs.
This is a multi-platform plugin, and each package is maintained independently. As part of it, each commit that changes the version is also tagged per platform.
The result is that changes that require multiple packages will require multiple commits - and hence multiple PRs.