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
When i am about to create a model, i write json to dart and use your repository, then add my copyWith and initial, lets say we have A model it contains
class A{
String b;
String c;
}
I generate your json to dart and add these
A copyWith({String b, String c}) {
return A(
b: b ?? this.b,
c: c ?? this.c
);
}
factory A.initial(){
return A(b:"", c:"");
}
I know that im asking this because of my lazyness but u can generate these for everyone(mostly me)
The text was updated successfully, but these errors were encountered:
This is not hard to do but the most valuable contribution here is you use case. I've created this tool to quickly generate a parser for JSON API, but you are using this tool to actually crate classes in dart, am I right?
If this is the case, I wasn't really considering this tool for such scenario but I would like to understand why would you prefer writing JSON instead of writing the dart class. What does this tool offer that makes it more convenient for you to write JSON than plain dart?
For me this would be fantastic in conjunction with #43 , as this is exactly how I currently have my hand written data model classes with hand written fromJson(), toJSON(), so I could then just use the convertor to completely generate all my currently hand written classes.
I think the key to this usecase is knowing that the generated classes are use as immutable data models, so having copyWith (and to lesser extent initial) would be a huge help. I suspect this would be common practise for Android developers coming from using Kotlin data classes in this manner.
When i am about to create a model, i write json to dart and use your repository, then add my copyWith and initial, lets say we have A model it contains
I generate your json to dart and add these
I know that im asking this because of my lazyness but u can generate these for everyone(mostly me)
The text was updated successfully, but these errors were encountered: