fromJson static method
Returns a new QueryPredicate instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static QueryPredicate? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
assert(json.containsKey(r'key'), 'Required key "QueryPredicate[key]" is missing from JSON.');
assert(json[r'key'] != null, 'Required key "QueryPredicate[key]" has a null value in JSON.');
assert(json.containsKey(r'value'), 'Required key "QueryPredicate[value]" is missing from JSON.');
assert(json[r'value'] != null, 'Required key "QueryPredicate[value]" has a null value in JSON.');
assert(json.containsKey(r'operator'), 'Required key "QueryPredicate[operator]" is missing from JSON.');
assert(json[r'operator'] != null, 'Required key "QueryPredicate[operator]" has a null value in JSON.');
return true;
}());
return QueryPredicate(
key: mapValueOfType<String>(json, r'key')!,
value: QueryPredicateValue.fromJson(json[r'value'])!,
operator_: QueryPredicateOperator_Enum.fromJson(json[r'operator'])!,
);
}
return null;
}