relatedJson property

  1. @override
dynamic get relatedJson
override

Implementation

@override
FieldRefInput? get relatedJson {
  var json;
  if (_create != null) {
    json = {
      "create": {
        "node": _create!.toJson(),
      }
    };
  } else if (_linkedId == null) {
    json = (canDisconnect && isDisconnect) ? {"disconnect": {}} : null;
  } else {
    json = {
      "connect": {
        "where": {
          "node": {
            "id": _linkedId,
          }
        }
      },
      // if (_recordType == null)
      if (canDisconnect)
        "disconnect": {
          "where": {
            "node": {
              "id_NOT": _linkedId,
            }
          }
        }
    };
  }

  return (_recordType != null && json != null)
      ? {
    _recordType: json,
  }
      : json;
}