Allows you to serialize object.
Map<String, dynamic> toJson() { Map<String, dynamic> result = {}; result["type"] = type; result["value"] = value?.toJson(); return result; }