diff --git a/angel_serialize_generator/CHANGELOG.md b/angel_serialize_generator/CHANGELOG.md index bdbab0b7..f97c84a0 100644 --- a/angel_serialize_generator/CHANGELOG.md +++ b/angel_serialize_generator/CHANGELOG.md @@ -1,6 +1,7 @@ # 2.0.2 * Generates an `XFields` class with the serialized names of all fields in a model class `X`. +* Removed unnecessary named parameters from `XSerializer.fromMap`. # 2.0.1 * Ensured that `List` is only transformed if diff --git a/angel_serialize_generator/lib/serialize.dart b/angel_serialize_generator/lib/serialize.dart index b670b7a3..73f4a2a0 100644 --- a/angel_serialize_generator/lib/serialize.dart +++ b/angel_serialize_generator/lib/serialize.dart @@ -128,17 +128,10 @@ class SerializerGenerator extends GeneratorForAnnotation { var buf = new StringBuffer('return new ${ctx.modelClassName}('); int i = 0; - // Add named parameters for (var field in ctx.fields) { if (ctx.excluded[field.name]?.canDeserialize == false) continue; var alias = ctx.resolveFieldName(field.name); - method.optionalParameters.add(new Parameter((b) { - b - ..name = field.name - ..named = true - ..type = convertTypeReference(field.type); - })); if (i++ > 0) buf.write(', '); diff --git a/angel_serialize_generator/test/models/author.serializer.g.dart b/angel_serialize_generator/test/models/author.serializer.g.dart index cb1f75fa..e3147621 100644 --- a/angel_serialize_generator/test/models/author.serializer.g.dart +++ b/angel_serialize_generator/test/models/author.serializer.g.dart @@ -7,15 +7,7 @@ part of angel_serialize.test.models.author; // ************************************************************************** abstract class AuthorSerializer { - static Author fromMap(Map map, - {String id, - String name, - int age, - List books, - Book newestBook, - String obscured, - DateTime createdAt, - DateTime updatedAt}) { + static Author fromMap(Map map) { return new Author( id: map['id'], name: map['name'], @@ -69,11 +61,7 @@ abstract class AuthorFields { } abstract class LibrarySerializer { - static Library fromMap(Map map, - {String id, - Map collection, - DateTime createdAt, - DateTime updatedAt}) { + static Library fromMap(Map map) { return new Library( id: map['id'], collection: map['collection'] is Map diff --git a/angel_serialize_generator/test/models/book.serializer.g.dart b/angel_serialize_generator/test/models/book.serializer.g.dart index 33ede5ba..96f29d74 100644 --- a/angel_serialize_generator/test/models/book.serializer.g.dart +++ b/angel_serialize_generator/test/models/book.serializer.g.dart @@ -7,16 +7,7 @@ part of angel_serialize.test.models.book; // ************************************************************************** abstract class BookSerializer { - static Book fromMap(Map map, - {String id, - String author, - String title, - String description, - int pageCount, - List notModels, - String camelCaseString, - DateTime createdAt, - DateTime updatedAt}) { + static Book fromMap(Map map) { return new Book( id: map['id'], author: map['author'],