subscribeToSensorSelectionStep method

void subscribeToSensorSelectionStep()

Subscribes to the sensor selection step and updates the test and calibration steps accordingly.

Implementation

void subscribeToSensorSelectionStep() {
  blocTask.stepResult.listen((RPResult result) {
    if (result.identifier == 'sensor_selection') {
      if (result is RPStepResult) {
        // Extract answer list safely
        final List<RPChoice>? answerList =
            result.results['answer'] as List<RPChoice>?;
        final answer = answerList?.first.value;
        if (answer != null) {
          _selectedSensor = (answer == 0) ? 'movesense' : 'smartphone';
          if (kDebugMode) {
            print('Selected sensor updated to $_selectedSensor');
          }
          _updateTugTest();
        }
      }
    }
  });
}