Skip to content

Commit 7cf5282

Browse files
committed
fixing hardcoded stuff
1 parent e55150b commit 7cf5282

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

templates/flutter/lib/src/models/model.dart.twig

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,19 @@ class {{ definition.name | caseUcfirst }} {
3939
{% endif %}
4040
};
4141
}
42-
4342
{% if definition.additionalProperties %}
43+
4444
T convertTo<T>(T Function(Map) fromJson) => fromJson(data);
4545
{% endif %}
46-
{% if definition.name == 'documentList' %}
46+
{% for property in definition.properties %}
47+
{% if property.sub_schema %}
48+
{% for def in spec.definitions %}
49+
{% if def.name == property.sub_schema and def.additionalProperties and property.type == 'array' %}
50+
4751
List<T> convertTo<T>(T Function(Map) fromJson) =>
48-
documents.map((d) => d.convertTo<T>(fromJson)).toList();
52+
{{property.name}}.map((d) => d.convertTo<T>(fromJson)).toList();
4953
{% endif %}
54+
{% endfor %}
55+
{% endif %}
56+
{% endfor %}
5057
}

0 commit comments

Comments
 (0)