Endpoints.fromJson constructor

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

Creates a Endpoints from JSON data.

Implementation

factory Endpoints.fromJson(Map<String, dynamic> json) {
  final tempApiVersionJson = json['apiVersion'];
  final tempKindJson = json['kind'];
  final tempMetadataJson = json['metadata'];
  final tempSubsetsJson = json['subsets'];

  final String? tempApiVersion = tempApiVersionJson;
  final String? tempKind = tempKindJson;
  final ObjectMeta? tempMetadata =
      tempMetadataJson != null ? ObjectMeta.fromJson(tempMetadataJson) : null;

  final List<EndpointSubset>? tempSubsets = tempSubsetsJson != null
      ? List<dynamic>.from(tempSubsetsJson)
          .map(
            (e) => EndpointSubset.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList()
      : null;

  return Endpoints(
    apiVersion: tempApiVersion,
    kind: tempKind,
    metadata: tempMetadata,
    subsets: tempSubsets,
  );
}