setLocation method
Sets the location
of a document for the given documentID
.
Implementation
Future<dynamic> setLocation(String documentID, GeoPoint location) async {
var docRef = this.collectionReference.doc(documentID);
var geoHash = GeoHash.encode(location.latitude, location.longitude);
// Create a Map with the fields to add
var updates = Map<String, dynamic>();
updates['g'] = geoHash;
updates['l'] = [location.latitude, location.longitude];
// Update the DocumentReference with the location data
return await docRef.set(updates, SetOptions(merge: true));
}