@@ -44,11 +44,7 @@ class ApiClient {
44
44
{ {#model} }
45
45
case '{ {classname} }':
46
46
{ {#isEnum} }
47
- // Enclose the value in a list so that Dartson can use a transformer
48
- // to decode it.
49
- final listValue = [value];
50
- final List<dynamic > listResult = dson.map(listValue, []);
51
- return listResult[0];
47
+ return new { {classname} }.fromJson(value);
52
48
{ {/isEnum} }
53
49
{ {^isEnum} }
54
50
return new { {classname} }.fromJson(value);
@@ -76,13 +72,13 @@ class ApiClient {
76
72
throw new ApiException(500, 'Could not find a suitable class for deserialization');
77
73
}
78
74
79
- dynamic deserialize(String json , String targetType) {
75
+ dynamic deserialize(String jsonVal , String targetType) {
80
76
// Remove all spaces. Necessary for reg expressions as well.
81
77
targetType = targetType.replaceAll(' ' , ' ' );
82
78
83
- if (targetType == ' String' ) return json ;
79
+ if (targetType == ' String' ) return jsonVal ;
84
80
85
- var decodedJson = JSON .decode(json );
81
+ var decodedJson = json .decode(jsonVal );
86
82
return _deserialize(decodedJson, targetType);
87
83
}
88
84
@@ -91,7 +87,7 @@ class ApiClient {
91
87
if (obj == null) {
92
88
serialized = ' ' ;
93
89
} else {
94
- serialized = JSON .encode(obj);
90
+ serialized = json .encode(obj);
95
91
}
96
92
return serialized;
97
93
}
0 commit comments