DarshanGowda0 / GeoFlutterFire

:fire:GeoFlutterFire:fire: is an open-source library that allows you to store and query firestore documents based on their geographic location.
https://youtu.be/MYHVyl-juUk
MIT License
305 stars 261 forks source link

GeoFlutterFire does not support nested objects like FireStore does #5

Closed DavidCorrado closed 5 years ago

DavidCorrado commented 5 years ago

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 https://github.com/DarshanGowda0/GeoFlutterFire/blob/82a24d3b6e2496faa612fd3d674f6c954b2a99ea/lib/src/collection.dart#L96

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

DarshanGowda0 commented 5 years ago

@DavidCorrado Yes that's a good enhancement. I'll be working on that soon along with other version issues.