javiercbk / json_to_dart

Library that generates dart classes from json strings
https://javiercbk.github.io/json_to_dart/
The Unlicense
1.33k stars 371 forks source link

Added copy constructor to model generator (non-private-fields) #48

Open andhieka opened 4 years ago

andhieka commented 4 years ago

Create copy constructor to help users who want to use generated models as immutable value types (copying object instead of directly modifying variables).

andhieka commented 4 years ago

This PR would partially fulfil the request in #42 as this adds copyWithUpdate.

Caveat This PR does not change behaviour when user uses "private fields" mode

Demo You can try it on my github pages

Example usage of copy constructor See in DartPad

CpdnCristiano commented 3 years ago

good job can i use on my project?