搜尋套件、儲存庫與 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。

所在榜單