simc / crimson

Fast, efficient and easy-to-use JSON parser and serializer for Dart.
Apache License 2.0
229 stars 6 forks source link

Mutable models #14

Closed hawkkiller closed 1 year ago

hawkkiller commented 1 year ago

The idea of having mutable models is bad from the start and has known limitations and issues.

simc commented 1 year ago

Would you mind explaining what you mean by this? If you prefer final properties you're free to do so.

hawkkiller commented 1 year ago

As I can see in the example you have mutable model with all the nullable fields. Generator also iteratively fills that model, I don't see any possibilities to make them final and not nullable.

simc commented 1 year ago

It's just an example. Final fields work just fine with Crimson

hawkkiller commented 1 year ago

image How?

simc commented 1 year ago

Add a constructor with these properties. This class makes no sense without