withinAsSingleStreamSubscription method

Stream<List<DocumentSnapshot<Object?>>> withinAsSingleStreamSubscription({
  1. required GeoFirePoint center,
  2. required double radius,
  3. required String field,
  4. bool strictMode = false,
})

Query firestore documents based on geographic radius from geoFirePoint center field specifies the name of the key in the document returns merged stream as broadcast stream.

Returns original stream from the underlying rxdart implementation, which could be safely cancelled without memory leaks. It's single stream subscription, so only single listener could be created at a time.

This works the best if you have central point of listening for locations, not per widget.

Implementation

Stream<List<DocumentSnapshot>> withinAsSingleStreamSubscription({
  required GeoFirePoint center,
  required double radius,
  required String field,
  bool strictMode = false,
}) {
  return _buildQueryStream(
    center: center,
    radius: radius,
    field: field,
    strictMode: strictMode,
  );
}