NodeSelectorTerm.fromJson constructor

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

Creates a NodeSelectorTerm from JSON data.

Implementation

factory NodeSelectorTerm.fromJson(Map<String, dynamic> json) {
  final tempMatchExpressionsJson = json['matchExpressions'];
  final tempMatchFieldsJson = json['matchFields'];

  final List<NodeSelectorRequirement>? tempMatchExpressions =
      tempMatchExpressionsJson != null
          ? List<dynamic>.from(tempMatchExpressionsJson)
              .map(
                (e) => NodeSelectorRequirement.fromJson(
                  Map<String, dynamic>.from(e),
                ),
              )
              .toList()
          : null;

  final List<NodeSelectorRequirement>? tempMatchFields =
      tempMatchFieldsJson != null
          ? List<dynamic>.from(tempMatchFieldsJson)
              .map(
                (e) => NodeSelectorRequirement.fromJson(
                  Map<String, dynamic>.from(e),
                ),
              )
              .toList()
          : null;

  return NodeSelectorTerm(
    matchExpressions: tempMatchExpressions,
    matchFields: tempMatchFields,
  );
}