Replies: 1 comment 3 replies
-
You can override toJson to manually remove the runtimeType key Although you'll likely need a custom toJson too if your API doesn't return this key, because then Freezed won't know how to decode the union. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a situation where I'm serializing a union object so I can make an HTTP request.
The issue is that when doing 'toJson()', the 'runtimeType' key is added making the API throw an error because there's unrecognized content on the request.
Is there a way to ignore the 'runtimeType' key the same way we do with 'JsonKey(ignore: true)' for the other attributes?
Beta Was this translation helpful? Give feedback.
All reactions