fromJson method

  1. @override
void fromJson(
  1. dynamic json
)
override

Deserializes JSON data into this object instance.

This method should populate the object's properties from the provided JSON data. The implementation should handle type conversion, null values, and nested objects as needed.

Parameters:

  • json: The JSON data to deserialize. Typically a Map<String, dynamic> or a List, but can be any type depending on the object's structure.

Example:

final model = MyModel();
model.fromJson({'name': 'John', 'age': 30});

Implementation

@override
void fromJson(dynamic json) {
  if (json is! Map<String, dynamic>) {
    return;
  }
  if (json.containsKey(FilterField.inList)) {
    inList = json[FilterField.inList];
  }
  if (json.containsKey(FilterField.notInList)) {
    notInList = json[FilterField.notInList];
  }
  if (json.containsKey(FilterField.equal)) {
    equal = json[FilterField.equal];
  }
  if (json.containsKey(FilterField.notEqual)) {
    notEqual = json[FilterField.notEqual];
  }
}