toJson method

Map<String, Object> toJson()

Converts a EndpointSubset instance to JSON data.

Implementation

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

  final tempAddresses = addresses;
  final tempNotReadyAddresses = notReadyAddresses;
  final tempPorts = ports;

  if (tempAddresses != null) {
    jsonData['addresses'] =
        tempAddresses.map((e) => e.toJson()).toList(growable: false);
  }

  if (tempNotReadyAddresses != null) {
    jsonData['notReadyAddresses'] =
        tempNotReadyAddresses.map((e) => e.toJson()).toList(growable: false);
  }

  if (tempPorts != null) {
    jsonData['ports'] =
        tempPorts.map((e) => e.toJson()).toList(growable: false);
  }

  return jsonData;
}