toJson method

Map<String, Object> toJson()

Converts a ObjectReference instance to JSON data.

Implementation

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

  final tempApiVersion = apiVersion;
  final tempFieldPath = fieldPath;
  final tempKind = kind;
  final tempName = name;
  final tempNamespace = namespace;
  final tempResourceVersion = resourceVersion;
  final tempUid = uid;

  if (tempApiVersion != null) {
    jsonData['apiVersion'] = tempApiVersion;
  }

  if (tempFieldPath != null) {
    jsonData['fieldPath'] = tempFieldPath;
  }

  if (tempKind != null) {
    jsonData['kind'] = tempKind;
  }

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

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

  if (tempResourceVersion != null) {
    jsonData['resourceVersion'] = tempResourceVersion;
  }

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

  return jsonData;
}