diff --git a/example/.packages b/example/.packages index 8cc6037..f520f93 100644 --- a/example/.packages +++ b/example/.packages @@ -3,7 +3,7 @@ # # For more info see: https://dart.dev/go/dot-packages-deprecation # -# Generated by pub on 2022-08-09 15:30:02.206771. +# Generated by pub on 2022-08-12 11:14:37.192298. _fe_analyzer_shared:file:///C:/Users/nymsa/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/_fe_analyzer_shared-44.0.0/lib/ analyzer:file:///C:/Users/nymsa/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/analyzer-4.4.0/lib/ args:file:///C:/Users/nymsa/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/args-2.1.1/lib/ diff --git a/example/lib/list/list.dart b/example/lib/list/list.dart index 5446100..3b7375a 100644 --- a/example/lib/list/list.dart +++ b/example/lib/list/list.dart @@ -6,8 +6,9 @@ part 'list.mapper.g.dart'; class Source { final List intList; final List entryList; + final List propList; - Source(this.intList, this.entryList); + Source(this.intList, this.entryList, this.propList); } class SourceEntry { @@ -32,6 +33,10 @@ class TargetEntry { @Mapper() abstract class ListMapper { + static List _mapPropList(Source source) => + source.entryList.map((e) => e.prop).toList(); + + @Mapping(target: 'propList', source: _mapPropList) Target fromSource(Source source); TargetEntry fromSourceEntry(SourceEntry source); } diff --git a/generator/lib/code_builders/class_builder.dart b/generator/lib/code_builders/class_builder.dart index 7b493fa..fa67f74 100644 --- a/generator/lib/code_builders/class_builder.dart +++ b/generator/lib/code_builders/class_builder.dart @@ -31,7 +31,10 @@ bool _isPrimitive(DartType type) { type.isDartCoreInt || type.isDartCoreNum || type.isDartCoreString || - (type is InterfaceType && type.superclass?.isDartCoreEnum == true); + (type is InterfaceType && type.superclass?.isDartCoreEnum == true) || + type.isDartCoreList || + type.isDartCoreSet || + type.isDartCoreMap; } Class _generateMapperImplementationClass(