toJson method

Map<String, Object> toJson()

Converts a TCPSocketAction instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempHost = host;
  final tempPort = port;

  if (tempHost != null) {
    jsonData['host'] = tempHost;
  }

  jsonData['port'] = tempPort;

  return jsonData;
}