@@ -108,27 +108,22 @@ class DefaultTemplate extends Template {
108
108
if (this is ListTemplate ) {
109
109
return this ;
110
110
}
111
- return ListTemplate (
112
- srcJson: srcJson, className: className, delegateTemplate: this );
111
+ return ListTemplate (srcJson: srcJson, className: className, delegateTemplate: this );
113
112
}
114
113
}
115
114
116
115
class ListTemplate extends DefaultTemplate {
117
116
Template delegateTemplate;
118
117
119
- ListTemplate (
120
- {String srcJson, String className = "Entity" , this .delegateTemplate})
121
- : super (className: className, srcJson: srcJson);
118
+ ListTemplate ({String srcJson, String className = "Entity" , this .delegateTemplate}) : super (className: className, srcJson: srcJson);
122
119
123
120
@override
124
121
String declare () {
125
- return _declareListMethod () + "\n " + delegateTemplate? .declare () ??
126
- super .declare ();
122
+ return _declareListMethod () + "\n " + delegateTemplate? .declare () ?? super .declare ();
127
123
}
128
124
129
125
String _declareListMethod () {
130
- var listMethod =
131
- """List<$className > get${className }List(List<dynamic> list){
126
+ var listMethod = """List<$className > get${className }List(List<dynamic> list){
132
127
List<$className > result = [];
133
128
list.forEach((item){
134
129
result.add($className .fromJson(item));
@@ -159,13 +154,11 @@ class ListTemplate extends DefaultTemplate {
159
154
}
160
155
161
156
@override
162
- List <Field > get fieldList =>
163
- FieldHelper (json.encode (json.decode (srcJson)[0 ])).getFields ();
157
+ List <Field > get fieldList => FieldHelper (json.encode (json.decode (srcJson)[0 ])).getFields ();
164
158
}
165
159
166
160
class V1Template extends DefaultTemplate {
167
- V1Template ({String srcJson, String className = "Entity" })
168
- : super (className: className, srcJson: srcJson);
161
+ V1Template ({String srcJson, String className = "Entity" }) : super (className: className, srcJson: srcJson);
169
162
170
163
@override
171
164
String interface () => "" ;
@@ -175,8 +168,7 @@ class V1Template extends DefaultTemplate {
175
168
var result = StringBuffer ();
176
169
result.writeln (super .method ());
177
170
result.writeln ();
178
- result.write (
179
- " Map<String, dynamic> toJson() => _\$ ${className }ToJson(this);" );
171
+ result.write (" Map<String, dynamic> toJson() => _\$ ${className }ToJson(this);" );
180
172
return result.toString ();
181
173
}
182
174
}
0 commit comments