removeStudy method

  1. @override
  2. @mustCallSuper
Future<void> removeStudy(
  1. String studyDeploymentId,
  2. String deviceRoleName
)
override

Remove the study with studyDeploymentId and deviceRoleName from this client manager.

Note that by removing a study, the deployment is not marked as stopped permanently in the deployment service. Hence, the study can later be added and deployed again using the addStudy and tryDeployment methods.

If a study deployment is to be permanently stopped, use the stopStudy method.

Implementation

@override
@mustCallSuper
Future<void> removeStudy(
  String studyDeploymentId,
  String deviceRoleName,
) async {
  var study = getStudy(studyDeploymentId, deviceRoleName);
  // fast out if not a valid study
  if (study == null) return;

  info('$runtimeType - Removing study: $study');

  AppTaskController().removeStudy(study);
  var controller = _controllers[study];
  if (controller != null) _group.remove(controller.measurements);
  controller?.dispose();
  _controllers.remove(study);
  await super.removeStudy(studyDeploymentId, deviceRoleName);
  notifyListeners();
}