From c6f0ec4c7159a2d9d3b2110ed506b99ff6bf0565 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Fri, 29 Jun 2018 11:30:47 -0400 Subject: [PATCH] Patch a cast error --- angel_serialize_generator/CHANGELOG.md | 3 +++ angel_serialize_generator/lib/serialize.dart | 2 +- angel_serialize_generator/pubspec.yaml | 2 +- .../test/models/author.serializer.g.dart | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/angel_serialize_generator/CHANGELOG.md b/angel_serialize_generator/CHANGELOG.md index 92f33bb8..51e9137e 100644 --- a/angel_serialize_generator/CHANGELOG.md +++ b/angel_serialize_generator/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.0.9+1 +* Fix a cast error when deserializing nested model classes. + # 2.0.9 * Upgrade to `source_gen@^0.8.0`. diff --git a/angel_serialize_generator/lib/serialize.dart b/angel_serialize_generator/lib/serialize.dart index b8e1aa78..f1883f6a 100644 --- a/angel_serialize_generator/lib/serialize.dart +++ b/angel_serialize_generator/lib/serialize.dart @@ -220,7 +220,7 @@ class SerializerGenerator extends GeneratorForAnnotation { map['$alias'] is Map ? new Map.unmodifiable((map['$alias'] as Map).keys.fold({}, (out, key) { return out..[key] = ${rc.pascalCase}Serializer - .fromMap((map['$alias'] as Map)[key]); + .fromMap(((map['$alias'] as Map)[key]) as Map); })) : null '''; diff --git a/angel_serialize_generator/pubspec.yaml b/angel_serialize_generator/pubspec.yaml index cd48f94b..703154fb 100644 --- a/angel_serialize_generator/pubspec.yaml +++ b/angel_serialize_generator/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_serialize_generator -version: 2.0.9 +version: 2.0.9+1 description: Model serialization generators, designed for use with Angel. Combine with angel_serialize for flexible modeling. author: Tobe O homepage: https://github.com/angel-dart/serialize diff --git a/angel_serialize_generator/test/models/author.serializer.g.dart b/angel_serialize_generator/test/models/author.serializer.g.dart index 7c95ff99..3d77a184 100644 --- a/angel_serialize_generator/test/models/author.serializer.g.dart +++ b/angel_serialize_generator/test/models/author.serializer.g.dart @@ -93,8 +93,8 @@ abstract class LibrarySerializer { ? new Map.unmodifiable( (map['collection'] as Map).keys.fold({}, (out, key) { return out - ..[key] = - BookSerializer.fromMap((map['collection'] as Map)[key]); + ..[key] = BookSerializer.fromMap( + ((map['collection'] as Map)[key]) as Map); })) : null, createdAt: map['created_at'] != null