Where.fromJson constructor

Where.fromJson(
  1. Map<String, dynamic> json
)

Creates a Where instance from a JSON map.

The JSON map should contain field-value pairs or field-operator-value pairs.

Example:

Where.fromJson({
  "age": {">=": 18},
  "status": "active",
  "type": {"\$in": ["user", "admin"]}
});

Implementation

factory Where.fromJson(Map<String, dynamic> json) {
  return Where(
      json.entries.map((e) => Filter.fromJson({e.key: e.value})).toList());
}