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
It'd be useful if DTOs (or all classes, so commands and queries as well? I really don't know) already came with copyWith() generated.
There could be some flag in contracts_generator.yaml to enable copyWith() generation (to reduce size of the generated code and time of generation when the project doesn't need this feature).
The text was updated successfully, but these errors were encountered:
Maybe the copy withs should be generated in a separate file as extension methods (which then will be re-exported by the contracts)? It will be annoying that contracts will have to be imported to be able to use copy with, but in return it will keep the original contracts file clean.
I would like to implement a more modular approach where anyone could provide custom annotations to generated classes. Then, one could annotated DTOs with @CopyWith() if they please. However this has a few issues:
Usually annotating is not enough and some extra modifications have to be applied to the class (for example @JsonSerializable() needs a fromJson constructor and a toJson method)
It needs a more granular approach than "annotate all"/"annotate none" (for example @CopyWith() will crash if annotated on an incorrect class). The means we would need some user-provided resolving unit, ie more than a config file
I hope that point 1 will get solved once promised metaprogramming lands in dart
It'd be useful if
DTO
s (or all classes, so commands and queries as well? I really don't know) already came withcopyWith()
generated.There could be some flag in
contracts_generator.yaml
to enablecopyWith()
generation (to reduce size of the generated code and time of generation when the project doesn't need this feature).The text was updated successfully, but these errors were encountered: