According to the Freezed documentation:
However, I'm using =>
in my code as follows:
factory ProductLineDTO.fromJson(Map<String, dynamic> json) =>
_$ProductLineDTOFromJson(json['node']);
Yet I get the toJson which I don't need. Any idea how to stop Freezed from generating toJson function?
Might be late, but according to the issues and the documentation, the right way to stop generating either toJson
or fromJson
is to use @Freezed()
instead of @freezed
For example
@Freezed(toJson: false, fromJson: true)
See the @Freezed source file
Or even the issue where the author of freezed, Remi Rousselet, mentions it