Fix bug where all natural fields were excluded

This commit is contained in:
Tobe O 2018-02-27 20:12:56 -05:00
parent 81e6263191
commit acce9a4bb8
3 changed files with 10 additions and 1 deletions

View file

@ -64,7 +64,7 @@ class SerializerGenerator extends GeneratorForAnnotation<Serializable> {
// Add named parameters // Add named parameters
for (var field in ctx.fields) { for (var field in ctx.fields) {
// Skip excluded fields // Skip excluded fields
if (ctx.excluded.containsKey(field.name)) continue; if (ctx.excluded[field.name] == true) continue;
var alias = ctx.resolveFieldName(field.name); var alias = ctx.resolveFieldName(field.name);

View file

@ -10,6 +10,10 @@ abstract class AuthorSerializer {
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {
'id': id, 'id': id,
'name': name,
'age': age,
'books': books,
'newest_book': newestBook,
'created_at': createdAt.toIso8601String(), 'created_at': createdAt.toIso8601String(),
'updated_at': updatedAt.toIso8601String() 'updated_at': updatedAt.toIso8601String()
}; };
@ -20,6 +24,7 @@ abstract class LibrarySerializer {
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {
'id': id, 'id': id,
'collection': collection,
'created_at': createdAt.toIso8601String(), 'created_at': createdAt.toIso8601String(),
'updated_at': updatedAt.toIso8601String() 'updated_at': updatedAt.toIso8601String()
}; };

View file

@ -10,6 +10,10 @@ abstract class BookSerializer {
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {
'id': id, 'id': id,
'author': author,
'title': title,
'description': description,
'page_count': pageCount,
'created_at': createdAt.toIso8601String(), 'created_at': createdAt.toIso8601String(),
'updated_at': updatedAt.toIso8601String() 'updated_at': updatedAt.toIso8601String()
}; };