Git Product home page Git Product logo

darshangowda0 / geoflutterfire Goto Github PK

View Code? Open in Web Editor NEW
305.0 14.0 258.0 205 KB

:fire:GeoFlutterFire:fire: is an open-source library that allows you to store and query firestore documents based on their geographic location.

Home Page: https://youtu.be/MYHVyl-juUk

License: MIT License

Kotlin 0.92% Ruby 5.74% Swift 1.04% Objective-C 0.10% Dart 92.21%
flutter firestore rxdart geohashing dart firebase

geoflutterfire's Introduction

GeoFlutterFire 🌍

version MIT License PRs Welcome

GeoFlutterFire is an open-source library that allows you to store and query a set of keys based on their geographic location. At its heart, GeoFlutterFire simply stores locations with string keys. Its main benefit, however, is the possibility of retrieving only those keys within a given geographic area - all in realtime.

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

GeoFlutterFire is designed as a lightweight add-on to cloud_firestore plugin. To keep things simple, GeoFlutterFire stores data in its own format within your Firestore database. This allows your existing data format and Security Rules to remain unchanged while still providing you with an easy solution for geo queries.

Heavily influenced by GeoFireX πŸ”₯πŸ”₯ from Jeff Delaney 😎

πŸ“Ί Checkout this amazing tutorial on fireship by Jeff, featuring the plugin!!

Getting Started

You should ensure that you add GeoFlutterFire as a dependency in your flutter project.

dependencies:
  geoflutterfire: <latest-version>

You can also reference the git repo directly if you want:

dependencies:
  geoflutterfire:
    git: git://github.com/DarshanGowda0/GeoFlutterFire.git

You should then run flutter packages get or update your packages in IntelliJ.

Example

There is a detailed example project in the example folder. Check that out or keep reading!

Initialize

You need a firebase project with Firestore setup.

import 'package:geoflutterfire/geoflutterfire.dart';
import 'package:cloud_firestore/cloud_firestore.dart';

// Init firestore and geoFlutterFire
final geo = Geoflutterfire();
final _firestore = FirebaseFirestore.instance;

Writing Geo data

Add geo data to your firestore document using GeoFirePoint

GeoFirePoint myLocation = geo.point(latitude: 12.960632, longitude: 77.641603);

Next, add the GeoFirePoint to you document using Firestore's add method

 _firestore
        .collection('locations')
        .add({'name': 'random name', 'position': myLocation.data});

Calling geoFirePoint.data returns an object that contains a geohash string and a Firestore GeoPoint. It should look like this in your database. You can name the object whatever you want and even save multiple points on a single document.

Query Geo data

To query a collection of documents with 50kms from a point

// Create a geoFirePoint
GeoFirePoint center = geo.point(latitude: 12.960632, longitude: 77.641603);

// get the collection reference or query
var collectionReference = _firestore.collection('locations');

double radius = 50;
String field = 'position';

Stream<List<DocumentSnapshot>> stream = geo.collection(collectionRef: collectionReference)
                                        .within(center: center, radius: radius, field: field);

The within function returns a Stream of the list of DocumentSnapshot data, plus some useful metadata like distance from the centerpoint.

stream.listen((List<DocumentSnapshot> documentList) {
        // doSomething()
      });

You now have a realtime stream of data to visualize on a map.

πŸ““ API

collection(collectionRef: CollectionReference)

Creates a GeoCollectionRef which can be used to make geo queries, alternatively can also be used to write data just like firestore's add / set functionality.

Example:

// Collection ref
// var collectionReference = _firestore.collection('locations').where('city', isEqualTo: 'bangalore');
var collectionReference = _firestore.collection('locations');
var geoRef = geo.collection(collectionRef: collectionReference);

Note: collectionReference can be of type CollectionReference or Query

Performing Geo-Queries

geoRef.within(center: GeoFirePoint, radius: double, field: String, {strictMode: bool})

Query the parent Firestore collection by geographic distance. It will return documents that exist within X kilometers of the center-point. field supports nested objects in the firestore document.

Note: Use optional parameter strictMode = true to filter the documents strictly within the bound of given radius.

Example:

// For GeoFirePoint stored at the root of the firestore document
geoRef.within(center: centerGeoPoint, radius: 50, field: 'position', strictMode: true);

// For GeoFirePoint nested in other objects of the firestore document
geoRef.within(center: centerGeoPoint, radius: 50, field: 'address.location.position', strictMode: true);

Each documentSnapshot.data() also contains distance calculated on the query.

Returns: Stream<List<DocumentSnapshot>>

Write Data

Write data just like you would in Firestore

geoRef.add(data)

Or use one of the client's conveniece methods

  • geoRef.setDoc(String id, var data, {bool merge}) - Set a document in the collection with an ID.
  • geoRef.setPoint(String id, String field, double latitude, double longitude)- Add a geohash to an existing doc

Read Data

In addition to Geo-Queries, you can also read the collection like you would normally in Firestore, but as an Observable

  • geoRef.data()- Stream of documentSnapshot
  • geoRef.snapshot()- Stream of Firestore QuerySnapshot

point(latitude: double, longitude: double)

Returns a GeoFirePoint allowing you to create geohashes, format data, and calculate relative distance.

Example: var point = geo.point(38, -119)

Getters

  • point.hash Returns a geohash string at precision 9
  • point.geoPoint Returns a Firestore GeoPoint
  • point.data Returns data object suitable for saving to the Firestore database

Geo Calculations

  • point.distance(latitude, longitude) Haversine distance to a point

Using Firestore withConverter method

If you want to use the collections or queries with this method, you should use GeoFlutterFire().collectionWithConverter<T>({ required Query<T> collectionRef }) instead of GeoFlutterFire().collection({ required Query<Map<String, dynamic>> collectionRef }).

Despite the different initializers, the only difference is in the within method, where in the former initialization you have a extra param that needs to return the GeoPoint from the data type in the query.

⚑ Tips

Scale to Massive Collections

It's possible to build Firestore collections with billions of documents. One of the main motivations of this project was to make geoqueries possible on a queried subset of data. You can pass a Query instead of a CollectionReference into the collection(), then all geoqueries will be scoped with the constraints of that query.

Note: This query requires a composite index, which you will be prompted to create with an error from Firestore on the first request.

Example:

var queryRef = _firestore.collection('locations').where('city', isEqualTo: 'bangalore');
var stream = geo
              .collection(collectionRef: queryRef)
              .within(center: center, radius: rad, field: 'position');

Usage of strictMode

It's advisable to use strictMode = false for smaller radius to make use of documents from neighbouring hashes as well.

As the radius increases to a large number, the neighbouring hash precisions fetch documents which would be considerably far from the radius bounds, hence its advisable to use strictMode = true for larger radius.

Note: filtering for strictMode happens on client side, hence filtering at larger radius is at the expense of making unnecessary document reads.

Make Dynamic Queries the RxDart Way

var radius = BehaviorSubject<double>.seeded(1.0);
var collectionReference = _firestore.collection('locations');

stream = radius.switchMap((rad) {
      return geo
          .collection(collectionRef: collectionReference)
          .within(center: center, radius: rad, field: 'position');
    });

// Now update your query
radius.add(25);

Limitations

  • range queries on multiple fields is not supported by cloud_firestore at the moment, since this library already uses range query on geohash field, you cannot perform range queries with GeoFireCollectionRef.
  • limit() and orderBy() are not supported at the moment. limit() could be used to limit docs inside each hash individually which would result in running limit on all 9 hashes inside the specified radius. orderBy() is first run on geohashes in the library, hence appending orderBy() with another feild wouldn't produce expected results. Alternatively documents can be sorted on client side.

geoflutterfire's People

Contributors

anatter avatar andrsdev avatar awaik avatar awhitford avatar darshangowda0 avatar felpsio avatar fredvanrijswijk avatar giorgio79 avatar jonastillges avatar kosukesaigusa avatar krojce avatar leonardoemili avatar lucadillenburg avatar luckyhandler avatar xmany avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geoflutterfire's Issues

GREAT!!! And in under 200 lines.

I want to first thank you for the code and breakdown on YouTube. Is there a way to keep track of the users and show them where the others users are while using the app?

Not getting any document from FireStore

I spent the entire weekend tried to fix this issue.
I had a similar issue with #42 . I had a collection used other plugin to support geoquery, then I used this plugin but get no data from the firestore.

I use json_serializable 2.0.0 and json_annotation 2.0.0 to wrap your GeoFirePoint.data into a dart class

part 'geo-location.g.dart';
@JsonSerializable(nullable: true)
class GeoLocation {

GeoPoint geopoint;
String geohash;

GeoLocation();

GeoLocation.from(GeoPoint point, String hash) {
this.geopoint = point;
this.geohash = hash;
}

factory GeoLocation.fromJson(Map<String, dynamic> map) => _$GeoLocationFromJson(map);

Map<String, dynamic> toJson() => _$GeoLocationToJson(this);
}

/* geo-location.g.dart */
GeoLocation _$GeoLocationFromJson(Map<String, dynamic> json) {
return GeoLocation()
..geopoint = json['geopoint'] == null
? null
: json['geopoint'] as GeoPoint
..geohash = json['geohash'] as String;
}

Map<String, dynamic> _$GeoLocationToJson(GeoLocation instance) =>
<String, dynamic>{
'geopoint': instance.geopoint,
'geohash': instance.geohash
};

Then in my data class, I define a field GeoLocation geoLocation to store the the GeoFirePoint.data. However if I use the json serializer to transform my object into Json to store in the Firestore, the GeoFlutterFire can't retrieve it, but if I use the raw data such as firestore.collection.document.update({'geoLocation': geoFirePoint.data) then the within can return this document. I verified the document in Firestore console, there is no difference between those two. Is there anything I did wrong?

Sorry I can't paste the code here, I can't make it reproducible in quick.

Error using query: com.google.firebase.firestore.FirebaseFirestoreException: INVALID_ARGUMENT: cursor position is outside the range of the original query

I tried to use a query as shown and I'm running into: com.google.firebase.firestore.FirebaseFirestoreException: INVALID_ARGUMENT: cursor position is outside the range of the original query.

What do you think is wrong? I checked the query by running it on it's own and it returns data but when I feed the query to the stream it chokes.

Query query = _firestore.collection('vehicleLocations')
.where('timestamp', isGreaterThan: timestamp)
.orderBy('timestamp');
var stream = _geo
.collection(collectionRef: query)
.within(center: center, radius: radius, field: 'position');

Radius units

Please confirm the units for radius. Is it kilometers?

Typo in readme

Readme text:

// Init firestore and geoFlutterFire
Geoflutterfire geo = GeoFlutterFire();

should be

// Init firestore and geoFlutterFire
Geoflutterfire geo = Geoflutterfire();

Thanks for this awesome package!

Update cloud_firestore dependency to ^0.13.0+1

Please update cloud_firestore dependency to ^0.13.0+1 is the latest release of it and our team would like to be up to date with firestore plugins ❀️(note that there is no breaking changes πŸŽ‰)

Issue when using where() to filter causing extra reads

Code
collectionRef: Firestore.instance .collection('vendors') .where('storeType', isEqualTo: 'Cafe') .where('vendorType', isEqualTo: 2).where('block', isEqualTo: false) .where('applicationStatus', isEqualTo: 3).where('isVisible', isEqualTo: true)

Scenario
As u can see i am using where(). However its causing me extra reads.
I have 100 items in 10km radius, but only one of them meets the criteria
.where('storeType', isEqualTo: 'Cafe)
But this caused me 100 reads.

Cloud Firestore version Mismatch

Because geoflutterfire >=2.0.3+3 depends on cloud_firestore ^0.10.1 and test_app depends on cloud_firestore ^0.11.0+1, geoflutterfire >=2.0.3+3 is forbidden.

GeoFlutterFire does not support nested objects like FireStore does

FireStore supports nested objects:
https://firebase.google.com/docs/firestore/manage-data/add-data?authuser=0#update_fields_in_nested_objects

So for geo field in my example is nested in an address object so I would use this as the field
"address.geoData"

So an example with this library I would be doing
Geoflutterfire().collection(collectionRef: Firestore.instance.collection('events')) .within(GeoFirePoint(geoPoint.latitude, geoPoint.longitude), 50, "address.geoData")

It succeeds in Firestore but your library does some work after the query to get the geoPoint. Below is the line of code

GeoPoint geoPoint = doc.data[field]['geopoint'];

Since its trying to get a map by a specific key it does not work with nesting.

Not sure the proper solution to this problem.

Work around
Put the geodata generated from this library in your root object

Can't build the project using GeoFlutter Fire

I just add GeoFlutter Fire to my pubspec and started throwing build erros:

(...)
    [!] Unable to determine Swift version for the following pods:
    - `geoflutterfire` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0/lib/cocoapods/installer/xcode/target_validator.rb:115:in `verify_swift_pods_swift_version'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0/lib/cocoapods/installer/xcode/target_validator.rb:37:in `validate!'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0/lib/cocoapods/installer.rb:459:in `validate_targets'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0/lib/cocoapods/installer.rb:138:in `install!'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0/lib/cocoapods/command/install.rb:48:in `run'
    /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:22:in `load'
    /usr/local/bin/pod:22:in `<main>'
Error output from CocoaPods:
↳
    Ignoring bindex-0.5.0 because its extensions are not built.  Try: gem pristine bindex --version 0.5.0
    Ignoring bootsnap-1.3.0 because its extensions are not built.  Try: gem pristine bootsnap --version 1.3.0
    Ignoring byebug-10.0.2 because its extensions are not built.  Try: gem pristine byebug --version 10.0.2
        WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
        Consider adding the following to ~/.profile:
        export LANG=en_US.UTF-8
        
    Ignoring duktape-1.6.1.0 because its extensions are not built.  Try: gem pristine duktape --version 1.6.1.0
    Ignoring ffi-1.9.23 because its extensions are not built.  Try: gem pristine ffi --version 1.9.23
    Ignoring json-2.1.0 because its extensions are not built.  Try: gem pristine json --version 2.1.0
    Ignoring msgpack-1.2.4 because its extensions are not built.  Try: gem pristine msgpack --version 1.2.4
    Ignoring nio4r-2.3.1 because its extensions are not built.  Try: gem pristine nio4r --version 2.3.1
    Ignoring nokogiri-1.8.2 because its extensions are not built.  Try: gem pristine nokogiri --version 1.8.2
    Ignoring puma-3.11.4 because its extensions are not built.  Try: gem pristine puma --version 3.11.4
    Ignoring unf_ext-0.0.7.5 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.5
    Ignoring websocket-driver-0.7.0 because its extensions are not built.  Try: gem pristine websocket-driver --version 0.7.0
    [!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error running pod install
Error launching application on iPhone XR.
Exited (sigterm)

flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel beta, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-BR)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[βœ“] iOS toolchain - develop for iOS devices (Xcode 10.1)
[βœ“] Android Studio (version 3.1)
[βœ“] VS Code (version 1.31.1)
[βœ“] Connected device (1 available)

I tried the versions 2.0.0 - 2.0.3. My pubspec related to firebase/geolocation packages:

firebase_auth: ^0.8.1+1
google_sign_in: ^4.0.1+1
flutter_facebook_login: ^1.2.0
cloud_firestore: ^0.9.0+2 #you have to run cd ios && pod update Firebase/Firestore
firebase_storage: ^2.1.0+1
geolocator: ^3.0.1
geoflutterfire: ^2.0.3

[Feature Request] Update within() to allow for flat data models

Currently, within() only takes one possible field as the "position" field, however in my use case I have a flat data model (i.e, geohash and geopoint fields are not in their own collection, but are fields within my main collection).

Thus, my data model looks as follows:
User:

  • username
  • email
  • geohash
  • geopoint

As opposed to:
User:

  • username
  • email
  • position:
    • geohash
    • geopoint

Thus, there are 2 separate fields that represent the "position"

I've hacked together my own solution by creating "flat_within" and "_flat_querypoint" methods, which I'll be happy to share and which works for now, but obviously will become an issue as this library grows.

I hope this has been clear :)

Question: How to use a where clause?

I want to filter the locations for a specific name.

e.g.:
_firestore.collection('locations')
.where('name',isequalTo: 'hotel')

Is that possible?

Weird behavior with streambuilder

I have a streambuilder that uses this as a stream:
stream: geo
.collection(collectionRef: collectionReference)
.within(
center: geoCenter.point(
latitude: 5.437534332275391, longitude: 100.30948638916016),
radius: 1000,
field: field,
strictMode: true)

Issue:
When i do that the streambuilder does not get the data. only when i press hot reload is get the data.

What works:
using this:
geo
.collection(collectionRef: collectionReference)
.within(
center: geoCenter.point(
latitude: 5.437534332275391, longitude: 100.30948638916016),
radius: 1000,
field: field,
strictMode: true)
and attaching a listener to it there is no issue.

Composite index not working for query with where

When i tried to add another criteria checking for the value of a specific field i get this error to create an index. I have created indexes before and for some reason the link provided NEVER works and always sends me to an error page. So i usually create the indexes manually. This time however, it wouldnt work so i am confused as to where i am going wrong with this? This is the error message i am getting :

Listen for Query(users where atEvent == true order by position.geohash, __name__) failed: Status{code=FAILED_PRECONDITION, description=The query requires an index. You can create it here: ```

So atEvent is the name of the field with the boolean and position is a map with geohash and also geopoint, so i tried creating a manual index with atEvent as a field (ascending) and position.geohash as another field (descending) and it wouldnt work. I also tried just using position and atEvent but didnt work either. How would i create this index? The package says that it supports this type of query and gives an example just like mine. This is my code for the query:

stream = radius.switchMap((rad) {
        var collectionReference = Firestore.instance.collection('users').where('atEvent',isEqualTo: true);
        return geo.collection(collectionRef: collectionReference).within(
            center: userLoc, radius: rad, field: 'position');
      });

UPDATE YOUR RXDART VERSION

Tried to update my bloc: pluggin and it mismatches sue to the following version solving error

Because no versions of geoflutterfire match >2.0.3+2 <3.0.0 and geoflutterfire 2.0.3+2 depends on rxdart ^0.20.0, geoflutterfire ^2.0.3+2 requires rxdart ^0.20.0.

And because bloc >=0.10.0 depends on rxdart ^0.21.0, geoflutterfire ^2.0.3+2 is incompatible with bloc >=0.10.0.
So, because thondan depends on both bloc ^0.11.2 and geoflutterfire ^2.0.3+2, version solving failed.

Combining with search leads to cursor errors

I'm combining search with Geoflutterfire.

For example, when searching for everything that starts with the letter a, I can use the following.

final Firestore firestore = Firestore.instance;
Query filteredRef = firestore.collection(my_collection')
          .where("query", isGreaterThanOrEqualTo: 'a')
          .where("query", isLessThan: 'b')
          .orderBy("query");

GeoFirePoint location = GeoFirePoint(0, 0);
Stream<List<DocumentSnapshot>> stream = geo
        .collection(collectionRef: filteredRef)
        .within(center: location, radius: 100, field: 'location');

However, this leads to the below erorr. I know there are results, so that shouldn't be an issue.

com.google.firebase.firestore.FirebaseFirestoreException: INVALID_ARGUMENT: cursor position is outside the range of the original query

When using only one filter (e.g. isEqual or isGreaterThanOrEqualTo) leads to no errors and works.

isLessThanOrEqualTo not working

I seem to get an PlatformException when I use this.

var queryRef = _firestore.collection('events').where('date', isLessThanOrEqualTo: int.parse(targetedDate));

PlatformException (PlatformException(error, Invalid query. You have an inequality where filter (whereLessThan(), whereGreaterThan(), etc.) on field 'date' and so you must also have 'date' as your first orderBy() field, but your first orderBy() is currently on field 'position.geohash' instead., null))

I don't get the error when I use isEqualTo. Anyone having the same issue? In my collection, I have a field called date which is converted to unix timestamp and it is a number.

var queryRef = _firestore.collection('events').where('date', isEqualTo: int.parse(targetedDate));

GeoFlutterFire Failing on Run

I am trying to build an app using GeoFlutterFire and it keeps on failing on build.

Output of flutter doctor -v

[βœ“] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.4 18E226, locale en-US)
    β€’ Flutter version 1.2.1 at /Users/austin/flutter
    β€’ Framework revision 8661d8aecd (3 months ago), 2019-02-14 19:19:53 -0800
    β€’ Engine revision 3757390fa4
    β€’ Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[βœ—] Android toolchain - develop for Android devices
    βœ— ANDROID_HOME = /usr/local/share/android-sdk
      but Android SDK not found at this location.

[!] iOS toolchain - develop for iOS devices (Xcode 10.2)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Xcode 10.2, Build version 10E125
    β€’ ios-deploy 1.9.4
    ! CocoaPods out of date (1.5.0 is recommended).
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To upgrade:
        brew upgrade cocoapods
        pod setup

[!] Android Studio (not installed)
    β€’ Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).

[βœ“] VS Code (version 1.33.1)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 2.26.1

Pubspec.yaml Dependencies

dependencies:
  flutter:
    sdk: flutter
  firebase_core: ^0.3.4
  cloud_firestore: ^0.9.13+1
  # firebase_analytics: ^2.1.1+3
  rxdart: ^0.21.0

  # geoflutterfire: ^2.0.3
  geoflutterfire:
    git: git://github.com/DarshanGowda0/GeoFlutterFire.git
  location: ^2.3.5
  google_maps_flutter: ^0.2.0

Output of flutter build -v
https://gist.github.com/Mr-Que/fcf2b1a3f67c5fa84ef05deec2009eed

Duplicate data in the result

I am getting duplicate data result.

Here is my code:

// I only have one document in the database
GeoFlutterfire()
        .collection(
            collectionRef: Firestore.instance.collection('countries'))
        .within(
            center: GeoFirePoint(45.208794, -133.5497394),
            radius: 50000,
            field: "location",
            strictMode: true).listen((snapshots){
int count = snapshots.length; // snapshots has two items of the same document.
});

How to obtain a list of geopoints only once?

My intend is to use GeoFlutterFire to obtain a list of places within certain radius and then use Firebase Database to obtain the rest of the data so I want to fetch this places list only once hence I don't want the Stream. Can anyone give me an example of how to complete this, please?

hi, where not work

hi, thank for your works!!
do you like help me?

-------- WORK PERFECT ----------------
var collectionReference = Firestore.instance.collection('userBasic').where('provider', isEqualTo: false).where('ispublic', isEqualTo: true);
var acata = await collectionReference.getDocuments();

--------WORK PERFECT----------------
stream = radius.switchMap((rad) {
var collectionReference = Firestore.instance.collection('userBasic')

  print('rad');
  return geo.collection(collectionRef: collectionReference).within(
        center: center,
        radius: rad,
        //strictMode: true,
        field: 'geoFirePoint',
      );
});

--------NOT WORK , NOT RETURN ----------------
stream = radius.switchMap((rad) {
var collectionReference = Firestore.instance.collection('userBasic').where('provider', isEqualTo: false).where('ispublic', isEqualTo: true);

  print('rad');
  return geo.collection(collectionRef: collectionReference).within(
        center: center,
        radius: rad,
        //strictMode: true,
        field: 'geoFirePoint',
      );
});

Collection group query support

Hey @DarshanGowda0,
I really appreciate the simplicity of your plugin.

When i tried to use a StreamBuilder with it like described in this issue, it works perfectly fine.

But when i changed the collectionReference to a collection group, there are no results. Can you confirm that collection group queries are unsupported?

[Feature Request] Get a GeoPoint based on the address

Is it possible to make this happen? I want the user to be able to input an address to the database that will also create a GeoPoint for that address if it is correct format (address). Or if anyone could point me to a library that already does this would be nice.

iOS build fails

Since upgrading to Xcode 11.2 for Mac Mojave I am getting this error trying to build for iOS.

Xcode build done.                                           30.7s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    /Users/jfraz/development/flutter/.pub-cache/hosted/pub.dartlang.org/geoflutterfire-2.0.3+5/ios/Classes/GeoflutterfirePlugin.m:4:17: error: definition of 'GeoflutterfirePlugin' must be imported from module 'geoflutterfire.GeoflutterfirePlugin' before it is required
    @implementation GeoflutterfirePlugin
                    ^
    In module 'geoflutterfire' imported from /Users/jfraz/development/flutter/.pub-cache/hosted/pub.dartlang.org/geoflutterfire-2.0.3+5/ios/Classes/GeoflutterfirePlugin.m:2:
    /Users/jfraz/development/stuller_power/build/ios/Debug-iphonesimulator/geoflutterfire/geoflutterfire.framework/Headers/GeoflutterfirePlugin.h:3:12: note: previous definition is here
    @interface GeoflutterfirePlugin : NSObject<FlutterPlugin>
               ^
    1 error generated.
Could not build the application for the simulator.
Error launching application on iPad Pro (11-inch).
Exited (sigterm)

Here is flutter doctor output:

[βœ“] Flutter (Channel dev, v1.10.15, on Mac OS X 10.14.6 18G103, locale en-US)
 
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[βœ“] Xcode - develop for iOS and macOS (Xcode 11.2)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 3.5)
[βœ“] VS Code (version 1.40.1)
[βœ“] Connected device (3 available)

! Doctor found issues in 1 category.

Finally, here is the relevant pubspec.yaml info:


environment:
  sdk: ">=2.2.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  font_awesome_flutter: 8.4.0
  flare_flutter: ^1.5.4

  firebase_core: ^0.4.0+3
  firebase_auth: ^0.11.1+6
  cloud_firestore: ^0.12.5

  rxdart: ^0.22.0
  geoflutterfire: ^2.0.3+5
  location: 2.3.5
  google_maps_flutter: ^0.5.16
  geohash: ^0.2.1

  provider: ^2.0.1
  meta: ^1.1.6
  url_launcher: ^5.0.3
  # path_provider: ^1.0.0
  date_format: ^1.0.6
  table_calendar: ^2.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter

Is it possible to use as one query instead of stream?

I need to use the geolocation query just once in a while instead of keeping a stream open. Is there a way to do it in the current implementation?

If anyone had an idea how to implement this in the plugin I can help with the implementation/PR

How to get/read a GeoFirePoint from a DocumentSnapshot

Where point is a GeoFirePoint instance, I was successful at writing the point to the database with something like:

    doc.reference.updateData({'geoLocation': point.data});

But now I am unable to read the point back (where doc is a DocumentSnapshot):

    final GeoFirePoint point = doc["geoLocation"];

It said:

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: type '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'GeoFirePoint'

What am I missing?

cloud_firestore upgrade to 0.10.x?

I ran into a version solving failure because of my dependency: cloud_firestore: ^0.10.1

Because geoflutterfire >=2.0.3 depends on cloud_firestore ^0.9.5+2 and MY_APP depends on cloud_firestore ^0.10.1, geoflutterfire >=2.0.3 is forbidden.

So, because MY_APP depends on geoflutterfire ^2.0.3+2, version solving failed.

Is it time to update dependencies and cut a new release? πŸ˜„

arrayContains causes exception

It doesn't seem to be working for me. I get PlatformException:
PlatformException (PlatformException(error, Invalid Query. Queries only support having a single array-contains filter., null))

var queryRef = _firestore.collection('events') .where('category', arrayContains: acceptedCategories) .where('organizer', arrayContains: acceptedOrganizers);

acceptedCategories & acceptedOrganizers are both lists.

var acceptedCategories = ["Casual", "Food", "Activites"]
var acceptedOrganizers = ["Non-Trusted", "Verified"]

Failed to build iOS app

I get the following build issue as soon as i build with the geoflutterfire: ^2.0.3+2 package installed. Any help would be greatly appreciated.

Here is the log i get:
`
Error output from Xcode build:
↳
** BUILD FAILED **

Xcode's output:
↳
=== BUILD TARGET cloud_firestore OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/carlose/flutter/.pub-cache/hosted/pub.dartlang.org/geoflutterfire-2.0.3+2/ios/Classes/Geo
flutterfirePlugin.m:2:9: fatal error: 'geoflutterfire/geoflutterfire-Swift.h' file not found
#import <geoflutterfire/geoflutterfire-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Could not build the application for the simulator.
Error launching application on iPhone X.
`

Here is my dependencies list:

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
firebase_core: ^0.3.1+1
cloud_firestore: ^0.9.7
firebase_auth: ^0.8.2+1
google_sign_in: ^3.2.4
rxdart: ^0.20.0
google_maps_flutter: ^0.4.0
location: ^2.3.2
geoflutterfire: ^2.0.3+2

Question: Is the within() method compatible with other sorts and limits

Hey,
could I use the within query with a limit and sort? For example could I get the top 50 best rated locations (rating being an extra attribute) by chaining a sort and a limit to the within method?

Also, would this produce 50 reads in firestore? Or would it produce one read for each result of within(), regardless of how many results I filter out by limit?

Thanks a lot.

Failed to build

I have issues to get it working. My build is updated to AndroidX already and all google/firebase plugins are running on the latest version. Any clue how to fix it?

* Error running Gradle:
ProcessException: Process "C:\Users\ebastuart\Desktop\flutter_project\android\gradlew.bat" exited abnormally:
> Configure project :app
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
> Configure project :geoflutterfire
WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getJavaCompile(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
         *********************************************************
WARNING: This version of cloud_firestore will break your Android build if it or its dependencies aren't compatible with AndroidX.
         See https://goo.gl/CP92wY for more information on the problem and how to fix it.
         This warning prints for all Android build failures. The real root cause of the error may be unrelated.
         *********************************************************
FAILURE: Build failed with an exception.
* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
The following dependencies do not satisfy the required version:
project ':geoflutterfire' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

Radius not properly working

Hi !

I have an issue with the radius : if I choose a radius of 2, even documents within a radius of 8 are returned.

And when I enter a radius bigger then 5, all documents within a radius of 60 are returned.

Stream<List<DocumentSnapshot>> stream = geo.collection(collectionRef: collectionReference)
                                        .within(center: center, radius: 2.0, field: field);
    stream.listen((List<DocumentSnapshot> documentList) {
      documentList.forEach((DocumentSnapshot document) {
        // ...
      });
    });
  }

I also tried using RXDart but the problem remains

var radius = BehaviorSubject<double>.seeded(1.0);
var collectionReference = _firestore.collection('locations');

stream = radius.switchMap((rad) {
      return geo
          .collection(collectionRef: collectionReference)
          .within(center: center, radius: rad, field: 'position');
    });

Any idea on how to solve this ?

Thanks for your amazing work !

Where / Compound Query Not Returning

I've been struggling with a bit of a bug where no data is being returned as soon as I use a QueryRef instead of the CollectionRef.

Issue
When using a QueryRef and the composite index is not created, no data is returned and errors are logged.

What is expected
An error saying an index needs to be created first. Apparently the url to generate this index used to bubble up, but this is not the case anymore.

Here is an example of the issue

Working

var query = Firestore.instance.collection('seekers');

var snap = await _geo
      .collection(collectionRef: query)
      .within(center: _geo.point(latitude: lat, longitude: lon), radius: locationRadius, field: location', strictMode: false)
      .first;

return snap;

Not Working

var query = Firestore.instance.collection('seekers').where('position', isEqualTo: 'none');

var snap = await _geo
      .collection(collectionRef: query)
      .within(center: _geo.point(latitude: lat, longitude: lon), radius: locationRadius, field: location', strictMode: false)
      .first;

return snap;

Solution
Add a composite index on Firebase including the where fields, and the geohash field - eg position: asc, location.geohash: asc

How GeoFlutterFire works

Might be useful to describe technically how this library works as it will help people make the decision to use this library. From my understanding this is how it works:

Geohash technical details
The library generates a 9 character geohash based off the lat long. This hashcode defines a rectangular box which is accurate within 5 meters you can see here

Based on the radius you send when doing Geo-Queries we reduce the number of characters in the geohash which increases the size of the rectangular box that covers the radius given above. We run the query based on that shortened geohash on the server side. Then locally we filters out data based on the circle generated by the radius.

Note:
Knowing that this library mostly runs on the server side makes this library be a big win which is not as clear from the description.

Once again thanks for all the work.

READ count

1, If I have a collection with 50000 items with geo data, and I use this library to filter out the distance with 10km from me, than it will cost 50000 READ count?

2, Can I use lets say: limit 50? (and it will cost 50 READ?)

3, Can I use getDocuments instead of stream?

4, Can I use collection('items').where('datetime', isGreaterThan: datetime) or not?

Flutter version solving failed.

Hi, im getting

Because flutter_google_places >=0.1.3 depends on rxdart ^0.19.0 and flutter_google_places <0.1.3 depends on rxdart ^0.18.1, every version of flutter_google_places requires rxdart ^0.18.1 or ^0.19.0.

And because every version of geoflutterfire depends on rxdart ^0.20.0, flutter_google_places is incompatible with geoflutterfire.

So, because XXXX depends on both geoflutterfire ^1.0.2 and flutter_google_places any, version solving failed.
pub get failed (1)
Process finished with exit code 1

Here is my flutter doctor
C:\src\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel master, v1.1.10-pre.200, on Microsoft Windows [Versión 6.1.7601], locale es-AR)
β€’ Flutter version 1.1.10-pre.200 at C:\src\flutter
β€’ Framework revision 74ebdacad5 (5 hours ago), 2019-01-28 13:07:02 -0500
β€’ Engine revision 9b6d5031a3
β€’ Dart version 2.1.1 (build 2.1.1-dev.3.2 a5030ed92f)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
β€’ Android SDK at C:\Users****\AppData\Local\Android\sdk
β€’ Android NDK location not configured (optional; useful for native profiling support)
β€’ Platform android-28, build-tools 28.0.3
β€’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
β€’ All Android licenses accepted.

[√] Android Studio (version 3.3)
β€’ Android Studio at C:\Program Files\Android\Android Studio
β€’ Flutter plugin version 32.0.1
β€’ Dart plugin version 182.5124
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[!] Connected device
! No devices available

! Doctor found issues in 1 category.
Process finished with exit code 0

Thanks you in advance

GeoFlutterFire Provider / Extract Logic

Good morning @DarshanGowda0!
In all examples, GeoFlutterFire is implemented in a StateFulWidget like this:

void initState() {
       super.initState();
       _latitudeController = TextEditingController();
       _longitudeController = TextEditingController();
   
       geo = Geoflutterfire();
       GeoFirePoint center = geo.point(latitude: 12.960632, longitude: 77.641603);
       stream = radius.switchMap((rad) {
         var collectionReference = _firestore.collection('locations');
   //          .where('name', isEqualTo: 'darshan');
         return geo
             .collection(collectionRef: collectionReference)
             .within(center: center, radius: rad, field: 'position');
       });
     }

But I'd like to extract the logic part (The GeoFlutterFire code) and export in another file containg all the logic and then convert the Widget in a StateLessWidget that will update everytime GeoFlutterFire has new data.

I made a class that implements:

Stream<List<DocumentReference>> neighbors;
neighbors = Geoflutterfire().collection(collectionRef: Firestore.instance.collection("users")).within(
        center: point,
        field: "position",
        radius: 0.2,
        strictMode: false
      );

In the StateLessWidget I use a StreamBuilder that listens to neighbors but it never receives anything, always null.

Probably I am making a mistake, do you suggest a better approach?

NoSuchMethodError (NoSuchMethodError: The getter 'hash' was called on null. Receiver: null Tried calling: hash)

I wrote the following function:

Stream<List> getListOfHangoutsAround() {
GeoFirePoint myLocation;
Geolocator().getLastKnownPosition().then((userpos) => {
myLocation = Geoflutterfire()
.point(longitude: userpos.longitude, latitude: userpos.latitude)
});
Query collectionReference = Firestore()
.collection('hangouts')
.where('IsActive', isEqualTo: true)
.limit(10);
double radius = 15; //Radius in km
Stream<List> stream = Geoflutterfire()
.collection(collectionRef: collectionReference)
.within(
center: myLocation,
radius: radius,
field: 'GeoLocation',
strictMode: true);

return stream;
}

When I debug, the GeoFirePoint myLocation is sucessfully initilized and has a geohash.
As soon as the App is running the .within() method, it throws the exception "NoSuchMethodError (NoSuchMethodError: The getter 'hash' was called on null. Receiver: null Tried calling: hash)".

What am I missing/doing wrong?

Thanks in advance!

GeoFlutterFire does not allow you to point to flutter Stable

I saw a report of this here but I think this is actually an issue
#2

Flutter Package Get

/Users/davidcorrado/Library/flutter/bin/flutter --no-color packages get
Running "flutter packages get" in APP NAME...                     
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.

Because APP NAME depends on geoflutterfire >=1.0.1 which requires SDK version >=2.1.0 <3.0.0, version solving failed.

pub get failed (1)
Process finished with exit code 1

Flutter Doctor

/Users/davidcorrado/Library/flutter/bin/flutter doctor --verbose
[βœ“] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14 18A391, locale en-US)
    β€’ Flutter version 1.0.0 at /Users/davidcorrado/Library/flutter
    β€’ Framework revision 5391447fae (2 months ago), 2018-11-29 19:41:26 -0800
    β€’ Engine revision 7375a0f414
    β€’ Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[βœ“] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    β€’ Android SDK at /Users/davidcorrado/Library/Android/sdk
    β€’ Android NDK location not configured (optional; useful for native profiling support)
    β€’ Platform android-28, build-tools 28.0.3
    β€’ ANDROID_HOME = /Users/davidcorrado/Library/Android/sdk
    β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    β€’ All Android licenses accepted.

[βœ“] iOS toolchain - develop for iOS devices (Xcode 10.1)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Xcode 10.1, Build version 10B61
    β€’ ios-deploy 1.9.4
    β€’ CocoaPods version 1.5.3

[βœ“] Android Studio (version 3.3)
    β€’ Android Studio at /Applications/Android Studio.app/Contents
    β€’ Flutter plugin version 31.3.3
    β€’ Dart plugin version 182.5124
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[βœ“] VS Code (version 1.30.2)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 2.22.3

[βœ“] Connected device (1 available)
    β€’ Android SDK built for x86 β€’ emulator-5554 β€’ android-x86 β€’ Android 9 (API 28) (emulator)

β€’ No issues found!
Process finished with exit code 0

Work around:
Point flutter to master

Notes:
If I run flutter package get with all other packages except this one works. So I imagine if you just run your library against stable and commit the changes that should fix this issue.

I love this library so far. It solves a pretty major issue with FireStore that was yet to be solved in Flutter yet.

Getting error on geoFirePoint.data()

Getting following error thrown when calling geoFirePoint.data()

I/flutter ( 4731): NoSuchMethodError: Class '_InternalLinkedHashMap<String, Object>' has no instance method 'call'.
I/flutter ( 4731): Receiver: _LinkedHashMap len:2
I/flutter ( 4731): Tried calling: call()

Here is my code
Geoflutterfire geo = Geoflutterfire();
GeoFirePoint geoFirePoint =
geo.point(latitude: location.latitude, longitude: location.longitude);

print(geoFirePoint.data());

Issue when using limit(1)

I have 2 orders Available

Order A is
geohash
"w0zqfx9ne"
geopoint
[5.4475907Β° N, 100.3067173Β° E]

Order B is
geohash
"w0zq3cprf"
geopoint
[5.3242402Β° N, 100.2822717Β° E]

My Position is
lat: 5.4375
long: 100.3095

stream = geo.collection(collectionRef: Firebase.instance.collection('orders').where('orderStatus', isEqualTo: 1) .limit(1)).within( center: geoCenter.point( latitude: myPosition.latitude, longitude: myPosition.longitude), radius: 10, field: field, strictMode: true);

What Dosent work:
When both orderStatus is equal to 1. I get back no documents
When orderStatus of A is set to 2, i get back no documents.

What Works:
When i change order B's orderStatus to 2, i get back order A.
When both order status are 1 and i set limit(2), i get back order A

Expected result:
Getting back document of Order A

My position to order B is 12.95 KM. I am not sure why its affecting the query.

Please test it out with the coordinates and hashes i listed.
This is weird behavior.

Not getting any Documents from Firestore

Hi @DarshanGowda0,

I'm currently trying to implement GeoFlutterFire in an app. I can write without any issue but when trying to get Documents from Firestore it always return an empty list.

Here's my code for getting data :

GeoFirePoint center = db.geoflutterfire.point(latitude : 40.4251669 , longitude : -3.7098554);
var init = Firestore.instance.collection("Tags"); db.geoflutterfire.collection(collectionRef: init).within( strictMode: false, center: center, field: "position", radius: 2, ).listen(_onNewTagsSnapshot);

The call back :

void _onNewTagsSnapshot(List<DocumentSnapshot> snapshot){
print("_onNewTagsSnapshot TRIGGERED *************"+snapshot.toString()); _listTagsControllerSink.add(snapshot); }

which always print an empty list even thought I have 4 documents corresponding to the query.

Here is how the database look like.

screenshot_tag

What Am I missing ? Thanks in advance. Best regards.

Version issue

Error:
Because geoflutterfire 2.0.3+4 depends on cloud_firestore ^0.11.0+1 and food_plus_life depends on cloud_firestore 0.12.1, geoflutterfire 2.0.3+4 is forbidden.

[Question] Limit and orderBy limitations

I've read that this plugin does not support limit() and orderBy() chaining on within().
However, does the plugin support the reference to do the limit() and orderBy() work?
Example:

    final ref = _instance
        .collection(collectionName)
        .orderBy(field, descending: true)
        .limit(limit);

    Geoflutterfire().collection(collectionRef: ref);

I'm getting mixed results coming back from the stream.

How to use GeoFlutterFire like a firestore stream?

Hi @DarshanGowda0,
first of all, thanks a lot for creating this awesome library!

Unfortunately I have some trouble getting it working the same way like my basic firestore streams.
So far I include my firestore queries directly as a stream in the StreamBuilder widget like this:
StreamBuilder( stream: Firestore.instance.collection('events') .where("eventTime", isGreaterThanOrEqualTo: DateTime.now().millisecondsSinceEpoch) .where("eventStatus", isEqualTo: "created") .orderBy('eventTime').snapshots(),
Here, .snapshots() returns a Stream<QuerySnapshot>, whereas your example returns a Stream<List<DocumentSnapshot>>.

Maybe you could provide an example how to use GeoFlutterFire the same way like the firestore query?
I don't really get the concept of the listener, and your readme says that I should be able to use geoRef.data() or geoRef.snapshot() to use it the same way like my other streams. I just can't figure out how :-)

Also, if I follow your readme exactly and use the listener, I receive this error:
com.google.firebase.firestore.FirebaseFirestoreException: INVALID_ARGUMENT: cursor position is outside the range of the original query

Thanks a lot,
Michael

Build fails

Hi
I am trying to build an app but I get the following error:

* Error running Gradle:
ProcessException: Process "D:\DEV\MobileApp\MyApp\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon, 1 busy and 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':geoflutterfire'.
> Failed to notify project evaluation listener.
   > java.lang.AbstractMethodError (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 23s
Picked up _JAVA_OPTIONS: -Xmx512M
  Command: D:\DEV\MobileApp\MyApp\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Exited (sigterm)

VERSIONS:

$ flutter doctor -v
[√] Flutter (Channel dev, v1.1.9, on Microsoft Windows [version 6.3.9600], locale fr-FR)
    β€’ Flutter version 1.1.9 at D:\DEV\DevTools\flutter
    β€’ Framework revision 1407091bfb (2 weeks ago), 2019-01-08 20:40:19 -0800
    β€’ Engine revision e5ec3cf3ea
    β€’ Dart version 2.1.1 (build 2.1.1-dev.0.1 2cb346bd0c)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    β€’ Android SDK at C:\Users\MrMaguy\AppData\Local\Android\sdk
    β€’ Android NDK location not configured (optional; useful for native profiling support)
    β€’ Platform android-28, build-tools 28.0.3
    β€’ ANDROID_HOME = C:\Users\MrMaguy\AppData\Local\Android\sdk
    β€’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    β€’ All Android licenses accepted.

[√] Android Studio (version 3.1)
    β€’ Android Studio at C:\Program Files\Android\Android Studio
    β€’ Flutter plugin version 28.0.1
    β€’ Dart plugin version 173.4700
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[!] IntelliJ IDEA Ultimate Edition (version 2017.1)
    β€’ IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.2
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    β€’ For information about installing plugins, see
      https://flutter.io/intellij-setup/#installing-the-plugins

[√] VS Code, 64-bit edition (version 1.30.2)
    β€’ VS Code at C:\Program Files\Microsoft VS Code
    β€’ Flutter extension version 2.21.1

[√] Connected device (1 available)
    β€’ Infinix X521 β€’ J5088A1R68265944 β€’ android-arm64 β€’ Android 6.0 (API 23)

! Doctor found issues in 1 category.

Also my current gradle version is 4.1
I mention that I also have firestore_auth and google_sign_in in dependencies

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.