@@ -10,14 +10,14 @@ class Query {
10
10
11
11
Map <String , dynamic > toJson () {
12
12
final result = < String , dynamic > {};
13
-
13
+
14
14
result['method' ] = method;
15
-
16
- if (attribute != null ) {
15
+
16
+ if (attribute != null ) {
17
17
result['attribute' ] = attribute;
18
18
}
19
-
20
- if (values != null ) {
19
+
20
+ if (values != null ) {
21
21
result['values' ] = values is List ? values : [values];
22
22
}
23
23
@@ -28,7 +28,7 @@ class Query {
28
28
String toString () => jsonEncode (toJson ());
29
29
30
30
/// Filter resources where [attribute] is equal to [value] .
31
- ///
31
+ ///
32
32
/// [value] can be a single value or a list. If a list is used
33
33
/// the query will return resources where [attribute] is equal
34
34
/// to any of the values in the list.
@@ -154,17 +154,18 @@ class Query {
154
154
Query ._('orderDesc' , attribute).toString ();
155
155
156
156
/// Sort results randomly.
157
- static String orderRandom () => Query ._('orderRandom' ).toString ();
157
+ static String orderRandom () =>
158
+ Query ._('orderRandom' ).toString ();
158
159
159
160
/// Return results before [id] .
160
- ///
161
+ ///
161
162
/// Refer to the [Cursor Based Pagination] (https://appwrite.io/docs/pagination#cursor-pagination)
162
163
/// docs for more information.
163
164
static String cursorBefore (String id) =>
164
165
Query ._('cursorBefore' , null , id).toString ();
165
166
166
167
/// Return results after [id] .
167
- ///
168
+ ///
168
169
/// Refer to the [Cursor Based Pagination] (https://appwrite.io/docs/pagination#cursor-pagination)
169
170
/// docs for more information.
170
171
static String cursorAfter (String id) =>
@@ -174,51 +175,27 @@ class Query {
174
175
static String limit (int limit) => Query ._('limit' , null , limit).toString ();
175
176
176
177
/// Return results from [offset] .
177
- ///
178
+ ///
178
179
/// Refer to the [Offset Pagination] (https://appwrite.io/docs/pagination#offset-pagination)
179
180
/// docs for more information.
180
181
static String offset (int offset) =>
181
182
Query ._('offset' , null , offset).toString ();
182
183
183
184
/// Filter resources where [attribute] is at a specific distance from the given coordinates.
184
- static String distanceEqual (
185
- String attribute,
186
- List <dynamic > values,
187
- num distance, [
188
- bool meters = true ,
189
- ]) => Query ._('distanceEqual' , attribute, [
190
- [values, distance, meters],
191
- ]).toString ();
185
+ static String distanceEqual (String attribute, List <dynamic > values, num distance, [bool meters = true ]) =>
186
+ Query ._('distanceEqual' , attribute, [[values, distance, meters]]).toString ();
192
187
193
188
/// Filter resources where [attribute] is not at a specific distance from the given coordinates.
194
- static String distanceNotEqual (
195
- String attribute,
196
- List <dynamic > values,
197
- num distance, [
198
- bool meters = true ,
199
- ]) => Query ._('distanceNotEqual' , attribute, [
200
- [values, distance, meters],
201
- ]).toString ();
189
+ static String distanceNotEqual (String attribute, List <dynamic > values, num distance, [bool meters = true ]) =>
190
+ Query ._('distanceNotEqual' , attribute, [[values, distance, meters]]).toString ();
202
191
203
192
/// Filter resources where [attribute] is at a distance greater than the specified value from the given coordinates.
204
- static String distanceGreaterThan (
205
- String attribute,
206
- List <dynamic > values,
207
- num distance, [
208
- bool meters = true ,
209
- ]) => Query ._('distanceGreaterThan' , attribute, [
210
- [values, distance, meters],
211
- ]).toString ();
193
+ static String distanceGreaterThan (String attribute, List <dynamic > values, num distance, [bool meters = true ]) =>
194
+ Query ._('distanceGreaterThan' , attribute, [[values, distance, meters]]).toString ();
212
195
213
196
/// Filter resources where [attribute] is at a distance less than the specified value from the given coordinates.
214
- static String distanceLessThan (
215
- String attribute,
216
- List <dynamic > values,
217
- num distance, [
218
- bool meters = true ,
219
- ]) => Query ._('distanceLessThan' , attribute, [
220
- [values, distance, meters],
221
- ]).toString ();
197
+ static String distanceLessThan (String attribute, List <dynamic > values, num distance, [bool meters = true ]) =>
198
+ Query ._('distanceLessThan' , attribute, [[values, distance, meters]]).toString ();
222
199
223
200
/// Filter resources where [attribute] intersects with the given geometry.
224
201
static String intersects (String attribute, List <dynamic > values) =>
@@ -251,4 +228,4 @@ class Query {
251
228
/// Filter resources where [attribute] does not touch the given geometry.
252
229
static String notTouches (String attribute, List <dynamic > values) =>
253
230
Query ._('notTouches' , attribute, [values]).toString ();
254
- }
231
+ }
0 commit comments