Filter.fromJson constructor
Implementation
factory Filter.fromJson(Map<String, dynamic> json) {
final type = json['type'];
if (type == null) {
throw FormatException('This is not a valid json for an Filter: ${jsonEncode(json)}');
}
switch (type) {
case FilterTypes.AND:
return AndLogicalFilter.fromJson(json);
case FilterTypes.OR:
return OrLogicalFilter.fromJson(json);
case FilterTypes.NOT:
return NotLogicalFilter.fromJson(json);
case FilterTypes.EQUAL:
return EqualFilter.fromJson(json);
case FilterTypes.NOT_EQUAL:
return NotEqualFilter.fromJson(json);
case FilterTypes.IN:
return InFilter.fromJson(json);
case FilterTypes.NOT_IN:
return NotInFilter.fromJson(json);
default:
throw UnsupportedError('Unknown extractor type: $type');
}
}