toJson method

Map<String, Object> toJson()

Converts a AllocationResult instance to JSON data.

Implementation

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

  final tempAvailableOnNodes = availableOnNodes;
  final tempResourceHandles = resourceHandles;
  final tempShareable = shareable;

  if (tempAvailableOnNodes != null) {
    jsonData['availableOnNodes'] = tempAvailableOnNodes.toJson();
  }

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

  if (tempShareable != null) {
    jsonData['shareable'] = tempShareable;
  }

  return jsonData;
}