toUpload static method

dynamic toUpload(
  1. TrackedEntityInstance trackedEntityInstance,
  2. List<Event>? events
)

Implementation

static toUpload(
    TrackedEntityInstance trackedEntityInstance, List<Event>? events) {
  return {
    "trackedEntityType": trackedEntityInstance.trackedEntityType,
    "orgUnit": trackedEntityInstance.orgUnit,
    "trackedEntityInstance": trackedEntityInstance.trackedEntityInstance,
    "attributes": (trackedEntityInstance.attributes ?? [])
        .map((attribute) => TrackedEntityAttributeValue.toUpload(attribute))
        .toList(),
    "enrollments": toUploadEnrollment(trackedEntityInstance, events),
    "relationships": (trackedEntityInstance.relationships ?? [])
        .map((relationship) =>
            TrackedEntityInstanceRelationship.toUpload(relationship))
        .toList(),
  };
}