@@ -32,15 +32,6 @@ abstract class QueryFieldOperator<T> {
32
32
/// where [other] is a field on the model.
33
33
bool evaluate (T ? other);
34
34
35
- /// Similar to `evaluate` , except `other` should be the
36
- /// *serialized* value of a field on the model.
37
- ///
38
- /// This should be used to support comparisons with models
39
- /// that were generated prior to `toMap()` being added.
40
- // TODO(Jordan-Nelson): remove at next major version bump
41
- @Deprecated ('Regenerate models with latest CLI and use `evaluate` instead.' )
42
- bool evaluateSerialized (T ? other);
43
-
44
35
Map <String , dynamic > serializeAsMap ();
45
36
46
37
Map <String , dynamic > serializeAsMapWithOperator (
@@ -55,16 +46,7 @@ abstract class QueryFieldOperator<T> {
55
46
56
47
/// check the type of [value] and invoke corresponding serialize method
57
48
dynamic serializeDynamicValue (dynamic value) {
58
- // DateTime is deprecated and will be removed in the next major version
59
- if (value is DateTime ) {
60
- if (zDebugMode) {
61
- safePrint (
62
- 'WARNING: Using DateTime types in a QueryPredicate is deprecated. '
63
- 'Use a Temporal Date/Time Type instead.' ,
64
- );
65
- }
66
- return value.toDateTimeIso8601String ();
67
- } else if (value is TemporalDate ) {
49
+ if (value is TemporalDate ) {
68
50
return value.format ();
69
51
} else if (value is TemporalDateTime ) {
70
52
return value.format ();
@@ -117,18 +99,6 @@ class EqualQueryOperator<T> extends QueryFieldOperatorSingleValue<T> {
117
99
118
100
return value == other;
119
101
}
120
-
121
- @override
122
- bool evaluateSerialized (T ? other) {
123
- // if `other` is a Map and has an "id" field, the query predicate is on a
124
- // nested model, such as `Post.BLOG.eq(myBlog.modelIdentifier))`,
125
- // and the value should be compared against the model ID.
126
- if (other is Map && other['id' ] != null && value is String ) {
127
- return value == other['id' ];
128
- }
129
- final serializedValue = serializeDynamicValue (value);
130
- return other == serializedValue;
131
- }
132
102
}
133
103
134
104
class EqualModelIdentifierQueryOperator <T extends ModelIdentifier >
@@ -141,13 +111,6 @@ class EqualModelIdentifierQueryOperator<T extends ModelIdentifier>
141
111
return other == value;
142
112
}
143
113
144
- @override
145
- bool evaluateSerialized (T ? other) {
146
- throw UnimplementedError (
147
- 'evaluateSerialized is not implemented for EqualModelIdentifierQueryOperator' ,
148
- );
149
- }
150
-
151
114
@override
152
115
Map <String , dynamic > serializeAsMap () {
153
116
return serializeAsMapWithOperator (type.toShortString (), value);
@@ -175,18 +138,6 @@ class NotEqualQueryOperator<T> extends QueryFieldOperatorSingleValue<T> {
175
138
}
176
139
return other != value;
177
140
}
178
-
179
- @override
180
- bool evaluateSerialized (T ? other) {
181
- // if `other` is a Map and has an "id" field, the query predicate is on a
182
- // nested model, such as `Post.BLOG.eq(myBlog.modelIdentifier))`,
183
- // and the value should be compared against the model ID.
184
- if (other is Map && other['id' ] != null && value is String ) {
185
- return value != other['id' ];
186
- }
187
- final serializedValue = serializeDynamicValue (value);
188
- return other != serializedValue;
189
- }
190
141
}
191
142
192
143
class NotEqualModelIdentifierQueryOperator <T extends ModelIdentifier >
@@ -199,13 +150,6 @@ class NotEqualModelIdentifierQueryOperator<T extends ModelIdentifier>
199
150
return other != value;
200
151
}
201
152
202
- @override
203
- bool evaluateSerialized (T ? other) {
204
- throw UnimplementedError (
205
- 'evaluateSerialized is not implemented for NotEqualModelIdentifierQueryOperator' ,
206
- );
207
- }
208
-
209
153
@override
210
154
Map <String , dynamic > serializeAsMap () {
211
155
return serializeAsMapWithOperator (type.toShortString (), value);
@@ -224,15 +168,6 @@ class LessOrEqualQueryOperator<T extends Comparable<Object?>>
224
168
}
225
169
return other.compareTo (value) <= 0 ;
226
170
}
227
-
228
- @override
229
- bool evaluateSerialized (T ? other) {
230
- if (other == null ) {
231
- return false ;
232
- }
233
- final serializedValue = serializeDynamicValue (value);
234
- return other.compareTo (serializedValue) <= 0 ;
235
- }
236
171
}
237
172
238
173
class LessThanQueryOperator <T extends Comparable <Object ?>>
@@ -247,15 +182,6 @@ class LessThanQueryOperator<T extends Comparable<Object?>>
247
182
}
248
183
return other.compareTo (value) < 0 ;
249
184
}
250
-
251
- @override
252
- bool evaluateSerialized (T ? other) {
253
- if (other == null ) {
254
- return false ;
255
- }
256
- final serializedValue = serializeDynamicValue (value);
257
- return other.compareTo (serializedValue) < 0 ;
258
- }
259
185
}
260
186
261
187
class GreaterOrEqualQueryOperator <T extends Comparable <Object ?>>
@@ -270,15 +196,6 @@ class GreaterOrEqualQueryOperator<T extends Comparable<Object?>>
270
196
}
271
197
return other.compareTo (value) >= 0 ;
272
198
}
273
-
274
- @override
275
- bool evaluateSerialized (T ? other) {
276
- if (other == null ) {
277
- return false ;
278
- }
279
- final serializedValue = serializeDynamicValue (value);
280
- return other.compareTo (serializedValue) >= 0 ;
281
- }
282
199
}
283
200
284
201
class GreaterThanQueryOperator <T extends Comparable <Object ?>>
@@ -293,15 +210,6 @@ class GreaterThanQueryOperator<T extends Comparable<Object?>>
293
210
}
294
211
return other.compareTo (value) > 0 ;
295
212
}
296
-
297
- @override
298
- bool evaluateSerialized (T ? other) {
299
- if (other == null ) {
300
- return false ;
301
- }
302
- final serializedValue = serializeDynamicValue (value);
303
- return other.compareTo (serializedValue) > 0 ;
304
- }
305
213
}
306
214
307
215
class ContainsQueryOperator extends QueryFieldOperatorSingleValue <String > {
@@ -323,9 +231,6 @@ class ContainsQueryOperator extends QueryFieldOperatorSingleValue<String> {
323
231
);
324
232
}
325
233
}
326
-
327
- @override
328
- bool evaluateSerialized (dynamic other) => evaluate (other);
329
234
}
330
235
331
236
class BetweenQueryOperator <T extends Comparable <Object ?>>
@@ -344,17 +249,6 @@ class BetweenQueryOperator<T extends Comparable<Object?>>
344
249
return other.compareTo (start) >= 0 && other.compareTo (end) <= 0 ;
345
250
}
346
251
347
- @override
348
- bool evaluateSerialized (T ? other) {
349
- if (other == null ) {
350
- return false ;
351
- }
352
- final serializedStart = serializeDynamicValue (start);
353
- final serializedEnd = serializeDynamicValue (end);
354
- return other.compareTo (serializedStart) >= 0 &&
355
- other.compareTo (serializedEnd) <= 0 ;
356
- }
357
-
358
252
@override
359
253
Map <String , dynamic > serializeAsMap () {
360
254
return < String , dynamic > {
@@ -376,7 +270,4 @@ class BeginsWithQueryOperator extends QueryFieldOperatorSingleValue<String> {
376
270
}
377
271
return other.startsWith (value);
378
272
}
379
-
380
- @override
381
- bool evaluateSerialized (String ? other) => evaluate (other);
382
273
}
0 commit comments