saveStudyProtocol method

  1. @override
Future<bool> saveStudyProtocol(
  1. String studyId,
  2. SmartphoneStudyProtocol study
)
override

Save a study on the local file system. Returns true if successful.

Implementation

@override
Future<bool> saveStudyProtocol(
  String studyId,
  SmartphoneStudyProtocol study,
) async {
  bool success = true;
  info("Saving study protocol - id: '$studyId'.");
  try {
    final json = jsonEncode(study);
    File(filename(studyId)).writeAsStringSync(json);
  } catch (exception) {
    success = false;
    warning("Failed to save study protocol '$studyId' - $exception");
  }

  return success;
}