Skip to content

Commit e0ea6ec

Browse files
committed
chore: fix dart
1 parent d4dc6d7 commit e0ea6ec

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

templates/cli/lib/type-generation/languages/dart.js.twig

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,16 @@ class Dart extends LanguageMeta {
3737
}
3838

3939
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+
<% } -%>
4144

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) %>,
4548
<% } -%>
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+
});
6350
}
6451
`;
6552
}

0 commit comments

Comments
 (0)