addStudyProtocol method

Future<Study> addStudyProtocol(
  1. StudyProtocol protocol
)

Create and add a study based on the protocol which needs to be executed on this client. This is similar to the addStudy method, but deploying the protocol immediately.

Returns the newly added study.

Implementation

Future<Study> addStudyProtocol(StudyProtocol protocol) async {
  assert(deploymentService != null,
      'Deployment Service has not been configured. Call configure() first.');

  StudyDeploymentStatus status =
      await deploymentService!.createStudyDeployment(protocol);
  Study study = Study(
    status.studyDeploymentId,
    status.masterDeviceStatus!.device.roleName,
  );

  await addStudy(study);
  return study;
}