tryDeployment method

  1. @mustCallSuper
Future<StudyStatus> tryDeployment(
  1. String studyDeploymentId
)
inherited

Verifies whether the device is ready for deployment of the study runtime identified by study, and in case it is, deploys. In case already deployed, nothing happens and the status of the deployment is returned.

Implementation

@mustCallSuper
Future<StudyStatus> tryDeployment(String studyDeploymentId) async {
  StudyRuntime? runtime = repository[studyDeploymentId];
  assert(runtime != null && runtime.study != null,
      'No runtime for this study found. Has this study been added using the addStudy method?');

  // Early out in case this runtime has already received and validated deployment information.
  if (runtime!.status.index >= StudyStatus.Deployed.index) {
    return runtime.status;
  }

  return await runtime.tryDeployment();
}