Endpoint.fromJson constructor

Endpoint.fromJson(
  1. Map<String, dynamic> json
)

Creates a Endpoint from JSON data.

Implementation

factory Endpoint.fromJson(Map<String, dynamic> json) {
  final tempAddressesJson = json['addresses'];
  final tempConditionsJson = json['conditions'];
  final tempDeprecatedTopologyJson = json['deprecatedTopology'];
  final tempHintsJson = json['hints'];
  final tempHostnameJson = json['hostname'];
  final tempNodeNameJson = json['nodeName'];
  final tempTargetRefJson = json['targetRef'];
  final tempZoneJson = json['zone'];

  final List<String> tempAddresses = List<String>.from(tempAddressesJson);
  final EndpointConditions? tempConditions = tempConditionsJson != null
      ? EndpointConditions.fromJson(tempConditionsJson)
      : null;

  final Map<String, String>? tempDeprecatedTopology =
      tempDeprecatedTopologyJson != null
          ? Map<String, String>.from(tempDeprecatedTopologyJson)
          : null;

  final EndpointHints? tempHints =
      tempHintsJson != null ? EndpointHints.fromJson(tempHintsJson) : null;
  final String? tempHostname = tempHostnameJson;
  final String? tempNodeName = tempNodeNameJson;
  final ObjectReference? tempTargetRef = tempTargetRefJson != null
      ? ObjectReference.fromJson(tempTargetRefJson)
      : null;
  final String? tempZone = tempZoneJson;

  return Endpoint(
    addresses: tempAddresses,
    conditions: tempConditions,
    deprecatedTopology: tempDeprecatedTopology,
    hints: tempHints,
    hostname: tempHostname,
    nodeName: tempNodeName,
    targetRef: tempTargetRef,
    zone: tempZone,
  );
}