stormberry icon indicating copy to clipboard operation
stormberry copied to clipboard

Feature: Generate client serialization classes

Open wstrange opened this issue 3 years ago • 0 comments

Something that serverpod.dev does that is pretty nifty is to generate model serialization code, and put the classes in a separate dart client package. It makes it really easy for a developer to pull the client package into a flutter app (or any client app). Until you use it, it's hard to appreciate what a game changer it is. It makes development much faster.

One thought might be to use something like Freezed to define the "model" class, with the proper annotations. Freezed gives you serialization, and a bunch of other nice features.

There are going to be properties of a freezed model that you don't want sent to the database. I think you could handle those using some kind of @ignore annotation (or re-use JsonKey?).

Food for thought..

wstrange avatar Mar 13 '23 18:03 wstrange