Skip to content

FileStudyProtocolManager

A StudyProtocolManager that loads and saves SmartphoneStudyProtocols as JSON files on the phone.

The path and filename format is given by filename.

Implemented types

Constructors

FileStudyProtocolManager

FileStudyProtocolManager()

Methods

filename

String filename(
  1. String studyId
)

The path and filename of the protocol with studyId, on the format

<localApplicationPath>/protocols/protocol-<study_id>.json

See Settings.localApplicationPath.

getStudyProtocol

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

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

initialize

Future<void> initialize()
override

Logs the protocol file path. No other setup is needed.

saveStudyProtocol

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

Saves study as JSON to filename. Returns true if successful.