andrasferenczi / dart-data-plugin

IDEA plugin for generating utility methods for Dart data classes
148 stars 31 forks source link

Provide an annotation / way to not serialize/deserialize particular field. #4

Open erluxman opened 5 years ago

erluxman commented 5 years ago

In some cases, we might not want a field to be (de)serializable, is there any already present solution or it needs to be worked on?

andrasferenczi commented 4 years ago

As far as I remember, you can select which variables you want to have serialized.

erluxman commented 4 years ago

Its a good option but if we have to select let's say 15 out of 25 fields it would be amazing if we could do that once with annotation so that we do not have to select them again and again for a small change in the model.

andrasferenczi commented 4 years ago

This issue has been here for a long time, so I just write my thoughts about this:

I understand that it may be tiring to reselect the fields you want the plugin to generate code for, but I don't have currently a solution for this (other than IntelliJ remembers your last selection most times).

The problem with a specific // serializable comment is that I don't like having to change the source code to accommodate this plugin's needs. So the usage of this plugin should be completely invisible to the developer (and later in version control as well).

@erluxman If you need only a handful of fields to be serializable, how would you instantiate the class again? Are those values always null?

If anyone has any idea/suggestion please comment.

erluxman commented 4 years ago

In my case they were some derived value, and the limitation of this library might have been actually good as I calculated them in runtime than initializing them