パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v2.0.7

flutter_geofire

近くの場所のリアルタイム更新を取得するためのFlutterプラグイン。GeoFireは、地理的位置に基づいてキーのセットを保存および照会できるオープンソースライブラリです。

AndroidiOS
30日間ダウンロード
434
いいね数
106
Pub ポイント
130

パッケージをインストール

flutter pub add flutter_geofire

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Flutter GeoFire は、オープンソースのライブラリである GeoFire を使用して、リアルタイムでの位置ベースのクエリを可能にする Flutter プラグインです。地理座標に基づいてデータを格納および取得できるため、近くの場所を検出する必要があるアプリケーションに最適です。Firebase と統合することで、ユーザーが移動する際のライブ更新をサポートし、正確で動的な位置追跡を保証します。このプラグインは、特に地図や近接アラートを含むモバイルアプリにおける地理空間操作を簡素化します。

用途

  • リアルタイムでの位置追跡
  • 近隣の観光スポットを検索する
  • ライブ乗車共有サービス
  • 位置ベースの通知
  • ジオフェンシングの実装

主な機能

  • リアルタイムの位置情報更新
  • Firebase との統合
  • Android および iOS をサポート
  • 効率的な空間クエリ
  • 近隣の場所フィルタリング

適している対象

  • 近接に基づく機能を必要とするアプリ
  • ライドシェアリングまたは配達プラットフォーム
  • 位置共有付きソーシャルネットワーキング
  • イベント発見アプリ
  • 場所に応じたIoTアプリケーション

注意事項

  • Firebase の設定が必要です
  • 地理空間クエリに限定
  • ネットワーク接続に依存しています
  • バッテリーの駆動時間に影響を与える可能性があります
  • 適切な権限処理が必要です

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

flutter_geofire

A Flutter plugin to use the GeoFire Api

For Flutter plugins for other products, see mrdishant@github

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

iOS Installation

In your project's pod file add the below line

pod 'GeoFire', :git => 'https://github.com/mrdishant/geofire-objc'

Example:

            target 'Runner' do
            use_frameworks!
            use_modular_headers!
            pod 'GeoFire', :git => 'https://github.com/mrdishant/geofire-objc'
            
            flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
            end

Usage

GeoFire — Realtime location queries with Firebase.

GeoFire is an open-source library that allows you to store and query a set of keys based on their geographic location.

At its heart, GeoFire simply stores locations with string keys. Its main benefit however, is the possibility of querying keys within a given geographic area - all in realtime.

GeoFire uses the Firebase database for data storage, allowing query results to be updated in realtime as they change. GeoFire selectively loads only the data near certain locations, keeping your applications light and responsive, even with extremely large datasets.

Quickstart

Initalize GeoFire with path to keys in Realtime Database

String pathToReference = "Sites";
Intializing geoFire
Geofire.initialize(pathToReference);

Also don't forget to add indexOn in your Realtime Database rules

Example: Just change the 'Sites' with your pathToReference

    {
      "rules": {
        ".read":true,
        ".write": true,
          "Sites": {
          ".indexOn": ["g"]
        }
      }
    }   
Setting location data

Here setLocation method is used and first is the unique id of the place and other two parameters are latitude and longitude of that place.

bool response = await Geofire.setLocation(
        new DateTime.now().millisecondsSinceEpoch.toString(),
        30.730743,
        76.774948)
Retrieving a location

Retrieving a location for a single key in GeoFire happens like below:

Map<String, dynamic> response =
        await Geofire.getLocation("AsH28LWk8MXfwRLfVxgx");

print(response);
Geo Queries

GeoFire allows you to query all keys within a geographic area using GeoQuery objects. As the locations for keys change, the query is updated in realtime and fires events letting you know if any relevant keys have moved. GeoQuery parameters can be updated later to change the size and center of the queried area.

Geofire.queryAtLocation(30.730743, 76.774948, 5).listen((map) {
        print(map);
        if (map != null) {
          var callBack = map['callBack'];

          //latitude will be retrieved from map['latitude']
          //longitude will be retrieved from map['longitude']

          switch (callBack) {
            case Geofire.onKeyEntered:
              keysRetrieved.add(map["key"]);
              break;

            case Geofire.onKeyExited:
              keysRetrieved.remove(map["key"]);
              break;

            case Geofire.onKeyMoved:
            // Update your key's location
              break;

            case Geofire.onGeoQueryReady:
            // All Intial Data is loaded
            print(map['result'])

              break;
          }
        }

        setState(() {});
Stop Listening to Geo Query

To remove listeners to all queries:

bool response = await Geofire.stopListener();

print(response);

Removing a location

To remove a location and delete it from the database simply pass the location's key to removeLocation:

bool response = await Geofire.removeLocation("AsH28LWk8MXfwRLfVxgx");

print(response);                

Contributing

if you want to contribute to GeoFire, clone the repository and just start making pull requests.

git clone 'https://github.com/mrdishant/flutter_geofire'
This plugin is in development and suggestions are most welcome. Happy Coding and Be Exceptional !!

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。