패키지, 저장소 및 앱 카테고리 검색

패키지 상세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 !!

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.