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.