toJson method

Map<String, Object> toJson()

Converts a ResourceClaimStatus instance to JSON data.

Implementation

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

  final tempAllocation = allocation;
  final tempDeallocationRequested = deallocationRequested;
  final tempDriverName = driverName;
  final tempReservedFor = reservedFor;

  if (tempAllocation != null) {
    jsonData['allocation'] = tempAllocation.toJson();
  }

  if (tempDeallocationRequested != null) {
    jsonData['deallocationRequested'] = tempDeallocationRequested;
  }

  if (tempDriverName != null) {
    jsonData['driverName'] = tempDriverName;
  }

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

  return jsonData;
}