EndpointSlice.fromJson constructor
Creates a EndpointSlice from JSON data.
Implementation
factory EndpointSlice.fromJson(Map<String, dynamic> json) {
final tempAddressTypeJson = json['addressType'];
final tempApiVersionJson = json['apiVersion'];
final tempEndpointsJson = json['endpoints'];
final tempKindJson = json['kind'];
final tempMetadataJson = json['metadata'];
final tempPortsJson = json['ports'];
final String tempAddressType = tempAddressTypeJson;
final String? tempApiVersion = tempApiVersionJson;
final List<Endpoint> tempEndpoints = List<dynamic>.from(tempEndpointsJson)
.map(
(e) => Endpoint.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList();
final String? tempKind = tempKindJson;
final ObjectMeta? tempMetadata =
tempMetadataJson != null ? ObjectMeta.fromJson(tempMetadataJson) : null;
final List<EndpointPort>? tempPorts = tempPortsJson != null
? List<dynamic>.from(tempPortsJson)
.map(
(e) => EndpointPort.fromJson(
Map<String, dynamic>.from(e),
),
)
.toList()
: null;
return EndpointSlice(
addressType: tempAddressType,
apiVersion: tempApiVersion,
endpoints: tempEndpoints,
kind: tempKind,
metadata: tempMetadata,
ports: tempPorts,
);
}