Closed
Description
We have a class that contains fields that we need to fetch from the server but we can't send back to the server. As such we want to be able to define a field as being readonly and for symmetries sake we should have the ability to mark a field as write only.
Read only
class Team
{
@JsonKey(readOnly: true)
List<User> members;
}
The readonly
argument would cause the json serializer to suppress the generation of the members
field in the toJson function.
Write only
class Team
{
@JsonKey(writeOnly: true)
List<User> members;
}
The writeOnly
argument would cause the json serializer to suppress the generation of the members
field in the fromJson function.