Setting the flag @Freezed(toJson: false)
creates an error in the generated freezed files when we define a custom toJson
.
#1070
Labels
Describe the bug
Let's assume that we need our own
fromJson
andtoJson
definitions for theModel
. We set the appropriate flags in the@Freezed(fromJson: false, toJson: false)
annotation. However, the generated files produce an error:To Reproduce
Expected behavior
Adding a constant private constructor solves this problem, because our
toJson
method becomes an ordinary method of theModel
class directly. So it turns out that we have to proceed according to the documentation Adding getters and methods to our models. Is this probably expected behavior?The text was updated successfully, but these errors were encountered: