You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem with using the Custom Serializable Objects approach is that in that case it can't be connected to the database. Or am I missing something? As far as I can tell only with the classes defined in yaml can they be used in the postgres tables.
So it seems currenlty my dilemma is I can either have classes that are equatable via freezed/equatable etc, or I can have them compatible with the built-in database, but not both. I'm trying to move a pre-existing large flutter project over to serverpod and this is basically a blocker for me until fixed, becuase I'm heavily dependent on classes being equatable (via Equatable package) for unit tests and some business logic that would be hard to change.
I hope this can be dealt with soon as I don't know what to do for now except being super-hacky and adding Equatable to the classes in the generated code after each serverpod generate which obviously is not workable long-term.
Activity
vlidholt commentedon Mar 20, 2023
This is a feature we should add.
For reference, Serverpod is compatible with Freezed if you prefer that for your serialization. More info here:
https://docs.serverpod.dev/concepts/serialization#custom-serializable-objects
wstrange commentedon Mar 20, 2023
WDYT about using Freezed as the base for generated models? You'd get
copyWIthfor "free". It might be a breaking change though...pro100andrey commentedon May 30, 2023
@vlidholt Hi,
I'm almost done with this functionality, and I will submit the pull request today. Do you have any preferences or specific requirements for it?
result file for client:
The only thing left is to implement the == operator.
Thanks!
vlidholt commentedon Jul 12, 2023
There is a good starting point for doing this here:
#976
jason-downs commentedon Aug 16, 2023
The problem with using the Custom Serializable Objects approach is that in that case it can't be connected to the database. Or am I missing something? As far as I can tell only with the classes defined in yaml can they be used in the postgres tables.
So it seems currenlty my dilemma is I can either have classes that are equatable via freezed/equatable etc, or I can have them compatible with the built-in database, but not both. I'm trying to move a pre-existing large flutter project over to serverpod and this is basically a blocker for me until fixed, becuase I'm heavily dependent on classes being equatable (via Equatable package) for unit tests and some business logic that would be hard to change.
I hope this can be dealt with soon as I don't know what to do for now except being super-hacky and adding Equatable to the classes in the generated code after each
serverpod generatewhich obviously is not workable long-term.