Git Product home page Git Product logo

geofire_flutter's Introduction

geofire_flutter

A Flutter plugin to use the GeoFire API IOS GeoFire API Android

This Plugin is re-created using flutter_geofire

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

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);

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.

response = await Geofire.queryAtLocation(30.730743, 76.774948, 5);

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/kishor98100/geofire_flutter
This plugin is in development suggestions are welcome. Happy Coding!!!

geofire_flutter's People

Contributors

kishormainali avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.