Open awhitford opened 5 years ago
So this is what I figured out I needed to do...
final GeoFirePoint point = GeoFirePoint(
doc["geoLocation"]["geopoint"].latitude,
doc["geoLocation"]["geopoint"].longitude);
This seems to work, but I'd prefer to see GeoFirePoint
treated like an opaque type, similar to GeoPoint
.
A constructor for GeoFirePoint
based on a GeoPoint
value would be better, then it could be:
final GeoFirePoint point = GeoFirePoint.fromGeoPoint(doc["geoLocation"]["geopoint"]);
However, this is still not ideal because it expects the user to understand how GeoFirePoint
is stored.
Any update on this ? There should be helper method fromJSON which should parse MAP type
Having the same issue. Is there a fix planned ?
I added some Dart Extension Methods in the meantime.
@awhitford looks like this is a breaking change.
This no longer works
Position position = await Geolocator()
.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
GeoFirePoint point = geo.point( position.latitude, position.longitude);
instead you need to provide keys
Position position = await Geolocator()
.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
GeoFirePoint point = geo.point(latitude: position.latitude, longitude: position.longitude);
Where
point
is aGeoFirePoint
instance, I was successful at writing the point to the database with something like:But now I am unable to read the point back (where
doc
is aDocumentSnapshot
):It said:
What am I missing?