搜索插件、代码仓与 APP 分类

插件详情v0.3.0

flutter_google_places_sdk_macos

Flutter 插件 for google places sdk 的 macOS 实现

macOS
近 30 天下载
4.5万
喜欢数
0
Pub 分数
150

安装插件

flutter pub add flutter_google_places_sdk_macos

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

macOS 专用的 Flutter 插件实现,用于 Google Places SDK,使开发者能够将 Google Places 功能集成到 macOS 应用程序中。该插件允许用户在原生 macOS 应用中直接搜索地点、获取地点详情以及访问自动补全建议。该包通过平台通道利用 Google 的 Places API,确保与底层 Google 服务的无缝交互。专为面向 macOS 的开发者设计,支持基于位置的搜索和地点预测功能,设置简单。

适合场景

  • 在 macOS 桌面应用中集成位置搜索
  • 实现地址自动补全
  • 获取位置的详细信息
  • 在 macOS 上构建旅行或物流应用
  • 在生产力工具中启用位置发现

主要特点

  • 原生 macOS 集成
  • 位置自动补全和搜索
  • 支持获取位置详细信息
  • 平台通道通信
  • 通过 Flutter pub 实现简易设置

适合对象

  • 使用位置功能开发 macOS 应用的开发者
  • 需要地址输入并提供建议的应用程序
  • 使用 Google Places API 的桌面应用程序
  • 面向跨平台 macOS 支持的 Flutter 团队
  • 需要在 Apple 桌面设备上提供可靠位置数据的项目

使用建议

  • 需要 Google Cloud Platform API 密钥
  • 仅限 macOS 平台
  • 依赖互联网连接
  • 如果跨平台使用,可能需要针对 iOS/Android 进行额外配置
  • API 使用可能会根据查询产生费用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

flutter_google_places_sdk

pub package

Tests

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.

Usage

To use this plugin, add flutter_google_places_sdk as a dependency in your pubspec.yaml file.

Web Usage

When using the web support you also need to enable the Maps JavaScript API in google cloud:

https://developers.google.com/maps/documentation/javascript/get-api-key

Limits:

  • 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';

void main() {
  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
  1. General code quality will adhere to new PRs, although nothing too strict. Specifics will discussed in each PRs.
  2. 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.

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。

所在榜单