freezed
freezed copied to clipboard
Comparing two instances of models' properties and find out which one was changed.
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] When we have a model and it has hundreds of properties, we really feel frustrated while checking whether its' instances are the same or not. Actually checking whether two instances are the same or not, is easy with freezed, equitable. But checking every property of it and figuring out which property has been changed is really hard code and much work. Maybe there is any other ways which is very simple but I don't know. if so, please let me know about it. I really need it.
Describe the solution you'd like Any methods inside freezed check two instances, and return changed properties with names and values. Or more detailed way.
In what context do you need to know how the objects differ?
In what context do you need to know how the objects differ?
Which properties of two objects are different? Imagine, I have two instances of the user model, which has 100 properties. one is changed by the user on the editing page. Now we have to know which property has been changed and let the backend know about it. At the moment I'm checking every property and comparing it with the old model instance. It's really hard code. I need somehow an easier way.
So the context is about sending only the diff to the backend?
You could compare the JSON output of two objects instead. Such as by using https://pub.dev/packages/json_diff
So the context is about sending only the diff to the backend?
You could compare the JSON output of two objects instead. Such as by using https://pub.dev/packages/json_diff
Great! I didn't know that package existed. Anyway, if freezed also supports that function(json patching). That would be great.
Considering there's a good-enough workaround, I don't plan on implementing this for now.