evaluateSerialized method

  1. @override
bool evaluateSerialized(
  1. T? other
)
override

Similar to evaluate, except other should be the serialized value of a field on the model.

This should be used to support comparisons with models that were generated prior to toMap() being added.

Implementation

@override
bool evaluateSerialized(T? other) {
  // if `other` is a Map and has an "id" field, the query predicate is on a
  // nested model, such as `Post.BLOG.eq(myBlog.modelIdentifier))`,
  // and the value should be compared against the model ID.
  if (other is Map && other['id'] != null && value is String) {
    return value == other['id'];
  }
  final serializedValue = serializeDynamicValue(value);
  return other == serializedValue;
}