Hi,
Given an example dto like the following, with serializable's toJson / fromJson methods
@JsonSerializable(explicitToJson: true)
class ActivityAssetsDto {
@JsonKey(name: 'image')
final String imageUrl;
const ActivityAssetsDto({this.imageUrl = ""});
factory ActivityAssetsDto.fromJson(Map<String, dynamic> json) =>
_$ActivityAssetsDtoFromJson(json);
Map<String, dynamic> toJson() => _$ActivityAssetsDtoToJson(this);
}
it generates
@override
ActivityAssetsDto fromActivityAssets(ActivityAssets entity) {
final activityassetsdto = ActivityAssetsDto.fromJson();
return activityassetsdto;
}
using "fromJson()" as constructor (obviously without parameter since it doesn't know what tu put there)
if I add a second parameter to the ActivityAssetsDto constructor the generator picks the correct constructors without problems.
It seems that the strategy of getting the constructor with the most arguments does not always work.
thank you for your time
Hi,
Given an example dto like the following, with serializable's toJson / fromJson methods
it generates
using "fromJson()" as constructor (obviously without parameter since it doesn't know what tu put there)
if I add a second parameter to the ActivityAssetsDto constructor the generator picks the correct constructors without problems.
It seems that the strategy of getting the constructor with the most arguments does not always work.
thank you for your time