getStudyController method

SmartphoneStudyController? getStudyController(
  1. SmartphoneStudy study
)

Returns the SmartphoneStudyController for study.

Creates a new controller the first time a study is looked up, and adds its measurements to measurements.

Implementation

SmartphoneStudyController? getStudyController(SmartphoneStudy study) {
  if (_controllers.containsKey(study)) return _controllers[study];

  // Create a fresh controller and start listening to it.
  final controller = SmartphoneStudyController(study);
  _controllers[study] = controller;
  _group.add(controller.measurements);
  return controller;
}