APIResourceList.fromJson constructor

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

Creates a APIResourceList from JSON data.

Implementation

factory APIResourceList.fromJson(Map<String, dynamic> json) {
  final tempApiVersionJson = json['apiVersion'];
  final tempGroupVersionJson = json['groupVersion'];
  final tempKindJson = json['kind'];
  final tempResourcesJson = json['resources'];

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

  final List<APIResource> tempResources =
      List<dynamic>.from(tempResourcesJson)
          .map(
            (e) => APIResource.fromJson(
              Map<String, dynamic>.from(e),
            ),
          )
          .toList();

  return APIResourceList(
    apiVersion: tempApiVersion,
    groupVersion: tempGroupVersion,
    kind: tempKind,
    resources: tempResources,
  );
}