@@ -9,17 +9,19 @@ class Query {
99 Query ._(this .method, [this .attribute = null , this .values = null ]);
1010
1111 Map <String , dynamic > toJson () {
12- final map = < String , dynamic > {'method' : method};
12+ final result = < String , dynamic > {};
13+
14+ result['method' ] = method;
1315
1416 if (attribute != null ) {
15- map ['attribute' ] = attribute;
17+ result ['attribute' ] = attribute;
1618 }
1719
1820 if (values != null ) {
19- map ['values' ] = values is List ? values : [values];
21+ result ['values' ] = values is List ? values : [values];
2022 }
2123
22- return map ;
24+ return result ;
2325 }
2426
2527 @override
@@ -35,7 +37,7 @@ class Query {
3537
3638 /// Filter resources where [attribute] is not equal to [value] .
3739 static String notEqual (String attribute, dynamic value) =>
38- Query ._('notEqual' , attribute, [ value] ).toString ();
40+ Query ._('notEqual' , attribute, value).toString ();
3941
4042 /// Filter resources where [attribute] is less than [value] .
4143 static String lessThan (String attribute, dynamic value) =>
@@ -111,6 +113,10 @@ class Query {
111113 static String createdAfter (String value) =>
112114 Query ._('createdAfter' , null , value).toString ();
113115
116+ /// Filter resources where document was created between [start] and [end] (inclusive).
117+ static String createdBetween (String start, String end) =>
118+ Query ._('createdBetween' , null , [start, end]).toString ();
119+
114120 /// Filter resources where document was updated before [value] .
115121 static String updatedBefore (String value) =>
116122 Query ._('updatedBefore' , null , value).toString ();
@@ -119,6 +125,10 @@ class Query {
119125 static String updatedAfter (String value) =>
120126 Query ._('updatedAfter' , null , value).toString ();
121127
128+ /// Filter resources where document was updated between [start] and [end] (inclusive).
129+ static String updatedBetween (String start, String end) =>
130+ Query ._('updatedBetween' , null , [start, end]).toString ();
131+
122132 static String or (List <String > queries) => Query ._(
123133 'or' ,
124134 null ,
@@ -166,4 +176,68 @@ class Query {
166176 /// docs for more information.
167177 static String offset (int offset) =>
168178 Query ._('offset' , null , offset).toString ();
179+
180+ /// Filter resources where [attribute] is at a specific distance from the given coordinates.
181+ static String distanceEqual (
182+ String attribute, List <dynamic > values, num distance,
183+ [bool meters = true ]) =>
184+ Query ._('distanceEqual' , attribute, [
185+ [values, distance, meters]
186+ ]).toString ();
187+
188+ /// Filter resources where [attribute] is not at a specific distance from the given coordinates.
189+ static String distanceNotEqual (
190+ String attribute, List <dynamic > values, num distance,
191+ [bool meters = true ]) =>
192+ Query ._('distanceNotEqual' , attribute, [
193+ [values, distance, meters]
194+ ]).toString ();
195+
196+ /// Filter resources where [attribute] is at a distance greater than the specified value from the given coordinates.
197+ static String distanceGreaterThan (
198+ String attribute, List <dynamic > values, num distance,
199+ [bool meters = true ]) =>
200+ Query ._('distanceGreaterThan' , attribute, [
201+ [values, distance, meters]
202+ ]).toString ();
203+
204+ /// Filter resources where [attribute] is at a distance less than the specified value from the given coordinates.
205+ static String distanceLessThan (
206+ String attribute, List <dynamic > values, num distance,
207+ [bool meters = true ]) =>
208+ Query ._('distanceLessThan' , attribute, [
209+ [values, distance, meters]
210+ ]).toString ();
211+
212+ /// Filter resources where [attribute] intersects with the given geometry.
213+ static String intersects (String attribute, List <dynamic > values) =>
214+ Query ._('intersects' , attribute, [values]).toString ();
215+
216+ /// Filter resources where [attribute] does not intersect with the given geometry.
217+ static String notIntersects (String attribute, List <dynamic > values) =>
218+ Query ._('notIntersects' , attribute, [values]).toString ();
219+
220+ /// Filter resources where [attribute] crosses the given geometry.
221+ static String crosses (String attribute, List <dynamic > values) =>
222+ Query ._('crosses' , attribute, [values]).toString ();
223+
224+ /// Filter resources where [attribute] does not cross the given geometry.
225+ static String notCrosses (String attribute, List <dynamic > values) =>
226+ Query ._('notCrosses' , attribute, [values]).toString ();
227+
228+ /// Filter resources where [attribute] overlaps with the given geometry.
229+ static String overlaps (String attribute, List <dynamic > values) =>
230+ Query ._('overlaps' , attribute, [values]).toString ();
231+
232+ /// Filter resources where [attribute] does not overlap with the given geometry.
233+ static String notOverlaps (String attribute, List <dynamic > values) =>
234+ Query ._('notOverlaps' , attribute, [values]).toString ();
235+
236+ /// Filter resources where [attribute] touches the given geometry.
237+ static String touches (String attribute, List <dynamic > values) =>
238+ Query ._('touches' , attribute, [values]).toString ();
239+
240+ /// Filter resources where [attribute] does not touch the given geometry.
241+ static String notTouches (String attribute, List <dynamic > values) =>
242+ Query ._('notTouches' , attribute, [values]).toString ();
169243}
0 commit comments