whereWithinPolygon method

void whereWithinPolygon(
  1. String column,
  2. List<ParseGeoPoint> points
)

Return an object with key coordinates be contained within and on the bounds of a given polygon. Supports closed and open (last point is connected to first) paths Polygon must have at least 3 points

Implementation

void whereWithinPolygon(String column, List<ParseGeoPoint> points) {
  if (points.length < 3) {
    throw ArgumentError('Polygon must have at least 3 points');
  }
  Map<String, dynamic> dictionary = <String, dynamic>{};
  dictionary['\$polygon'] = points.map((e) => e.toJson()).toList();

  queries.add(MapEntry<String, dynamic>(
      _singleQuery, '"$column":{"\$geoWithin":${jsonEncode(dictionary)}}'));
}