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

插件详情v0.3.0

flutter_google_places_sdk_http

一个用于其他平台实现的 HTTP 插件实现

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
4.5万
喜欢数
1
Pub 分数
130

安装插件

flutter pub add flutter_google_places_sdk_http

插件介绍

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

一个 Flutter 包,提供基于 HTTP 的实现,用于将 Google Places 功能集成到应用程序中。它支持在 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台上进行位置、地点和地址搜索。该包设计为其他特定平台实现的基础层,通过 HTTP 请求与 Google Places API 通信,无需原生代码即可提供灵活性和兼容性。非常适合希望获得轻量级、跨平台地点查询和自动补全功能的开发者。

适合场景

  • 在表单中使用地址自动补全
  • 地址搜索与选择
  • 地理位置数据获取
  • 跨平台位置服务
  • 与基于地图的应用程序集成

主要特点

  • 基于HTTP的API通信
  • 多平台支持
  • 轻量且模块化的设计
  • 与原生插件兼容
  • 通过 HTTP 请求实现简单集成

适合对象

  • 开发跨平台应用的开发者
  • 无需原生 SDK 的应用需要位置搜索
  • 使用自定义平台实现的项目
  • 更倾向于使用 HTTP 而非原生依赖的团队

使用建议

  • 需要互联网连接
  • 依赖 Google Places API 密钥
  • 仅限 HTTP 请求功能
  • 不是完整的原生插件
  • 可能需要为 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.

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目

暂无相关数据。

所在榜单