toJson method
Converts a PortStatus instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempError = error;
final tempPort = port;
final tempProtocol = protocol;
if (tempError != null) {
jsonData['error'] = tempError;
}
jsonData['port'] = tempPort;
jsonData['protocol'] = tempProtocol;
return jsonData;
}