toJson method

Map<String, Object> toJson()

Converts a ResourceRequirements instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempClaims = claims;
  final tempLimits = limits;
  final tempRequests = requests;

  if (tempClaims != null) {
    jsonData['claims'] =
        tempClaims.map((e) => e.toJson()).toList(growable: false);
  }

  if (tempLimits != null) {
    jsonData['limits'] = tempLimits;
  }

  if (tempRequests != null) {
    jsonData['requests'] = tempRequests;
  }

  return jsonData;
}