getStudyProtocol method

  1. @override
Future<SmartphoneStudyProtocol?> getStudyProtocol(
  1. String studyId
)
override

Get a SmartphoneStudyProtocol based on its id. Returns null if no protocol exists.

Implementation

@override
Future<SmartphoneStudyProtocol?> getStudyProtocol(String studyId) async {
  info("Loading study '$studyId'.");
  SmartphoneStudyProtocol? study;

  try {
    String jsonString = File(filename(studyId)).readAsStringSync();
    study = SmartphoneStudyProtocol.fromJson(
        json.decode(jsonString) as Map<String, dynamic>);
  } catch (exception) {
    warning("Failed to load study '$studyId' - $exception");
  }

  return study;
}