stopStudy method

  1. @mustCallSuper
Future<StudyStatus> stopStudy(
  1. String studyDeploymentId,
  2. String deviceRoleName
)

Permanently stop collecting data for the study with id studyDeploymentId and mark it as stopped.

Once a study is stopped it cannot be deployed anymore since it will be marked as permanently stopped in the deployment service.

If you want to remove the study from this client and be able to redeploy it later, use the removeStudy method instead. Note that stopping a study does not remove it from this client manager.

Implementation

@mustCallSuper
Future<StudyStatus> stopStudy(
  String studyDeploymentId,
  String deviceRoleName,
) async {
  _checkConfiguration();

  var study = getStudy(studyDeploymentId, deviceRoleName);

  if (study == null) {
    throw IllegalArgumentException(
      "A study with the study deployment ID '$studyDeploymentId' "
      "and device role name '$deviceRoleName' was not found. "
      "Has this study been added using the addStudy method?",
    );
  }
  var status = study.status;
  await proxy?.stop(study);
  var newStatus = study.status;
  if (status != newStatus) repository.updateStudy(study);

  return newStatus;
}