setPoint method

Future<void> setPoint(
  1. String id,
  2. String field,
  3. double latitude,
  4. double longitude,
)

set a geo point with latitude and longitude using field as the object key to the document with id

Implementation

Future<void> setPoint(
    String id, String field, double latitude, double longitude) {
  try {
    CollectionReference colRef = _collectionReference;
    var point = GeoFirePoint(latitude, longitude).data;
    return colRef.doc(id).set({'$field': point}, SetOptions(merge: true));
  } catch (e) {
    throw Exception(
        'cannot call set on Query, use collection reference instead');
  }
}