Skip to content

Commit

Permalink
Integration with package json_serialize
Browse files Browse the repository at this point in the history
  • Loading branch information
d-markey committed Feb 21, 2022
1 parent 8b3d2f7 commit bd7804a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/src/descriptors/field_descriptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class FieldDescriptor {
return '$json[${name.stringLiteral()}]';
} else {
final accessor = nullable ? '?' : '';
return '$json[${name.stringLiteral()}]$accessor.map((item) => ${type.getDeserializer('(item as Map)')}).toList()';
return '$json[${name.stringLiteral()}]$accessor.map((item) => ${type.getDeserializer('(item as Map<String, dynamic>)')}).toList()';
}
} else {
if (type.isScalar) {
return '$json[${name.stringLiteral()}]';
} else if (nullable) {
return '($json[${name.stringLiteral()}] == null) ? null : ${type.getDeserializer('($json[${name.stringLiteral()}] as Map)')}';
return '($json[${name.stringLiteral()}] == null) ? null : ${type.getDeserializer('($json[${name.stringLiteral()}] as Map<String, dynamic>)')}';
} else {
return type.getDeserializer('($json[${name.stringLiteral()}] as Map)');
return type.getDeserializer('($json[${name.stringLiteral()}] as Map<String, dynamic>)');
}
}
}
Expand Down

0 comments on commit bd7804a

Please sign in to comment.