Map<String, dynamic> toJson() { final port = this.port; final protocol = this.protocol; return { if (port != null) 'port': port, if (protocol != null) 'protocol': protocol.toValue(), }; }