toJson method

Map<String, Object> toJson()

Converts a ParentReference instance to JSON data.

Implementation

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

  final tempGroup = group;
  final tempName = name;
  final tempNamespace = namespace;
  final tempResource = resource;
  final tempUid = uid;

  if (tempGroup != null) {
    jsonData['group'] = tempGroup;
  }

  if (tempName != null) {
    jsonData['name'] = tempName;
  }

  if (tempNamespace != null) {
    jsonData['namespace'] = tempNamespace;
  }

  if (tempResource != null) {
    jsonData['resource'] = tempResource;
  }

  if (tempUid != null) {
    jsonData['uid'] = tempUid;
  }

  return jsonData;
}