QuisApp / flutter_contacts

MIT License
84 stars 140 forks source link

Making Contact immutable and Adding a copyWith() method. #84

Closed yassinsameh closed 1 year ago

yassinsameh commented 1 year ago

A copyWith() method can be useful for cloning an Object or getting a copy while changing one or more fields. I also found it useful when doing Load testing, i needed to have thousands of unique contacts and having the copyWith method was helpful.

yassinsameh commented 1 year ago

Commits include tests added and previous examples/test updated for the new syntax. Was having edge case bugs because of contacts being mutable, think this change makes it much cleaner and makes projects less error prone, please take a look to validate. Great job overall on the package. @joachimvalente

dphans commented 8 months ago

Follow Clean Architecture, I think you no need to do that, instead, custom domain Model (eg. ContactModel) and custom copyWith as you need.

Screenshot 2024-01-06 at 14 25 34