@@ -37,29 +37,16 @@ class Dart extends LanguageMeta {
37
37
}
38
38
39
39
getTemplate() {
40
- return `import 'package:appwrite/models.dart';
40
+ return `class <%= toPascalCase(collection.name) %> {
41
+ <% for (const [index, attribute] of Object .entries(collection.attributes)) { -%>
42
+ <%= getType(attribute) %> <%= toCamelCase(attribute.key) %> ;
43
+ <% } -%>
41
44
42
- class <% - toPascalCase(collection.name) %> extends Document {
43
- <% for (const attribute of collection.attributes) { -%>
44
- final <% - getType (attribute) %> <% - toCamelCase(attribute.key) %> ;
45
+ <%= toPascalCase(collection.name) %> ( {
46
+ <% for (const [index, attribute] of Object .entries( collection.attributes) ) { -%>
47
+ <% if (attribute.required) { %> required <% } %> this. <%= toCamelCase(attribute.key) %> ,
45
48
<% } -%>
46
-
47
- <% - toPascalCase(collection.name) %> ({
48
- required String $id,
49
- required String $collectionId,
50
- required String $databaseId,
51
- required DateTime $createdAt,
52
- required DateTime $updatedAt,
53
- <% for (const attribute of collection.attributes) { -%>
54
- required this.<% - toCamelCase(attribute.key) %> ,
55
- <% } -%>
56
- }) : super(
57
- $id: $id,
58
- $collectionId: $collectionId,
59
- $databaseId: $databaseId,
60
- $createdAt: $createdAt,
61
- $updatedAt: $updatedAt,
62
- );
49
+ });
63
50
}
64
51
`;
65
52
}
0 commit comments