APIVersions.fromJson constructor

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

Creates a APIVersions from JSON data.

Implementation

factory APIVersions.fromJson(Map<String, dynamic> json) {
  final tempApiVersionJson = json['apiVersion'];
  final tempKindJson = json['kind'];
  final tempServerAddressByClientCIDRsJson =
      json['serverAddressByClientCIDRs'];
  final tempVersionsJson = json['versions'];

  final String? tempApiVersion = tempApiVersionJson;
  final String? tempKind = tempKindJson;

  final List<ServerAddressByClientCIDR> tempServerAddressByClientCIDRs =
      List<dynamic>.from(tempServerAddressByClientCIDRsJson)
          .map(
            (e) => ServerAddressByClientCIDR.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList();

  final List<String> tempVersions = List<String>.from(tempVersionsJson);

  return APIVersions(
    apiVersion: tempApiVersion,
    kind: tempKind,
    serverAddressByClientCIDRs: tempServerAddressByClientCIDRs,
    versions: tempVersions,
  );
}