Patch a cast error

This commit is contained in:
Tobe O 2018-06-29 11:30:47 -04:00
parent bda96a39fd
commit c6f0ec4c71
4 changed files with 7 additions and 4 deletions

View file

@ -1,3 +1,6 @@
# 2.0.9+1
* Fix a cast error when deserializing nested model classes.
# 2.0.9 # 2.0.9
* Upgrade to `source_gen@^0.8.0`. * Upgrade to `source_gen@^0.8.0`.

View file

@ -220,7 +220,7 @@ class SerializerGenerator extends GeneratorForAnnotation<Serializable> {
map['$alias'] is Map map['$alias'] is Map
? new Map.unmodifiable((map['$alias'] as Map).keys.fold({}, (out, key) { ? new Map.unmodifiable((map['$alias'] as Map).keys.fold({}, (out, key) {
return out..[key] = ${rc.pascalCase}Serializer return out..[key] = ${rc.pascalCase}Serializer
.fromMap((map['$alias'] as Map)[key]); .fromMap(((map['$alias'] as Map)[key]) as Map);
})) }))
: null : null
'''; ''';

View file

@ -1,5 +1,5 @@
name: angel_serialize_generator 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. description: Model serialization generators, designed for use with Angel. Combine with angel_serialize for flexible modeling.
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/serialize homepage: https://github.com/angel-dart/serialize

View file

@ -93,8 +93,8 @@ abstract class LibrarySerializer {
? new Map.unmodifiable( ? new Map.unmodifiable(
(map['collection'] as Map).keys.fold({}, (out, key) { (map['collection'] as Map).keys.fold({}, (out, key) {
return out return out
..[key] = ..[key] = BookSerializer.fromMap(
BookSerializer.fromMap((map['collection'] as Map)[key]); ((map['collection'] as Map)[key]) as Map);
})) }))
: null, : null,
createdAt: map['created_at'] != null createdAt: map['created_at'] != null