toJson method

Map<String, Object> toJson()

Converts a ServiceReference instance to JSON data.

Implementation

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

  final tempName = name;
  final tempNamespace = namespace;
  final tempPath = path;
  final tempPort = port;

  jsonData['name'] = tempName;

  jsonData['namespace'] = tempNamespace;

  if (tempPath != null) {
    jsonData['path'] = tempPath;
  }

  if (tempPort != null) {
    jsonData['port'] = tempPort;
  }

  return jsonData;
}