@@ -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};
13-
12+ final result = < String , dynamic > {};
13+
14+ result['method' ] = method;
15+
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) =>
@@ -176,50 +178,50 @@ class Query {
176178 Query ._('offset' , null , offset).toString ();
177179
178180 /// Filter resources where [attribute] is at a specific distance from the given coordinates.
179- static String distanceEqual (String attribute, List <dynamic > values, double distance, [bool meters = true ]) =>
180- Query ._('distanceEqual' , attribute, [values, distance, meters]).toString ();
181+ static String distanceEqual (String attribute, List <dynamic > values, num distance, [bool meters = true ]) =>
182+ Query ._('distanceEqual' , attribute, [[ values, distance, meters] ]).toString ();
181183
182184 /// Filter resources where [attribute] is not at a specific distance from the given coordinates.
183- static String distanceNotEqual (String attribute, List <dynamic > values, double distance, [bool meters = true ]) =>
184- Query ._('distanceNotEqual' , attribute, [values, distance, meters]).toString ();
185+ static String distanceNotEqual (String attribute, List <dynamic > values, num distance, [bool meters = true ]) =>
186+ Query ._('distanceNotEqual' , attribute, [[ values, distance, meters] ]).toString ();
185187
186188 /// Filter resources where [attribute] is at a distance greater than the specified value from the given coordinates.
187- static String distanceGreaterThan (String attribute, List <dynamic > values, double distance, [bool meters = true ]) =>
188- Query ._('distanceGreaterThan' , attribute, [values, distance, meters]).toString ();
189+ static String distanceGreaterThan (String attribute, List <dynamic > values, num distance, [bool meters = true ]) =>
190+ Query ._('distanceGreaterThan' , attribute, [[ values, distance, meters] ]).toString ();
189191
190192 /// Filter resources where [attribute] is at a distance less than the specified value from the given coordinates.
191- static String distanceLessThan (String attribute, List <dynamic > values, double distance, [bool meters = true ]) =>
192- Query ._('distanceLessThan' , attribute, [values, distance, meters]).toString ();
193+ static String distanceLessThan (String attribute, List <dynamic > values, num distance, [bool meters = true ]) =>
194+ Query ._('distanceLessThan' , attribute, [[ values, distance, meters] ]).toString ();
193195
194196 /// Filter resources where [attribute] intersects with the given geometry.
195197 static String intersects (String attribute, List <dynamic > values) =>
196- Query ._('intersects' , attribute, values).toString ();
198+ Query ._('intersects' , attribute, [ values] ).toString ();
197199
198200 /// Filter resources where [attribute] does not intersect with the given geometry.
199201 static String notIntersects (String attribute, List <dynamic > values) =>
200- Query ._('notIntersects' , attribute, values).toString ();
202+ Query ._('notIntersects' , attribute, [ values] ).toString ();
201203
202204 /// Filter resources where [attribute] crosses the given geometry.
203205 static String crosses (String attribute, List <dynamic > values) =>
204- Query ._('crosses' , attribute, values).toString ();
206+ Query ._('crosses' , attribute, [ values] ).toString ();
205207
206208 /// Filter resources where [attribute] does not cross the given geometry.
207209 static String notCrosses (String attribute, List <dynamic > values) =>
208- Query ._('notCrosses' , attribute, values).toString ();
210+ Query ._('notCrosses' , attribute, [ values] ).toString ();
209211
210212 /// Filter resources where [attribute] overlaps with the given geometry.
211213 static String overlaps (String attribute, List <dynamic > values) =>
212- Query ._('overlaps' , attribute, values).toString ();
214+ Query ._('overlaps' , attribute, [ values] ).toString ();
213215
214216 /// Filter resources where [attribute] does not overlap with the given geometry.
215217 static String notOverlaps (String attribute, List <dynamic > values) =>
216- Query ._('notOverlaps' , attribute, values).toString ();
218+ Query ._('notOverlaps' , attribute, [ values] ).toString ();
217219
218220 /// Filter resources where [attribute] touches the given geometry.
219221 static String touches (String attribute, List <dynamic > values) =>
220- Query ._('touches' , attribute, values).toString ();
222+ Query ._('touches' , attribute, [ values] ).toString ();
221223
222224 /// Filter resources where [attribute] does not touch the given geometry.
223225 static String notTouches (String attribute, List <dynamic > values) =>
224- Query ._('notTouches' , attribute, values).toString ();
226+ Query ._('notTouches' , attribute, [ values] ).toString ();
225227}
0 commit comments