Map<String, dynamic> toJson() { return <String, dynamic>{ if (id != null) r'id': id, if (type != null) r'type': type, }; }