Skip to content

SmartphoneClientRepository

Stores the studies of the SmartPhoneClientManager on the phone.

A singleton ClientRepository that keeps studies in memory and saves them with the PersistenceService, so they survive app restarts.

Implemented types

Constructors

SmartphoneClientRepository

SmartphoneClientRepository()

Returns the singleton SmartphoneClientRepository.

Properties

deviceRegistration

DeviceRegistration? deviceRegistration
getter/setter pairoverride

The DeviceRegistration used to register the client in deployments.

studyStatusEvents

Stream<StudyStatusEvent<SmartphoneStudy>> get studyStatusEvents

The StudyStatusEvents of all studies in this repository.

Methods

addStudy

void addStudy(
  1. SmartphoneStudy study
)
override

Adds study to the repository.

If study with the same study deployment id and device role name as study already exists in this repository, nothing happens. If a study needs to be updated, use the updateStudy method.

getStudy

SmartphoneStudy? getStudy(
  1. String studyDeploymentId,
  2. String deviceRoleName
)
override

Return the study with studyDeploymentId and deviceRoleName, or null when no such study is found.

getStudyList

List<SmartphoneStudy> getStudyList()
override

Return all studies in this repository. May be an empty list if no studies have been added.

hasStudy

bool hasStudy(
  1. SmartphoneStudy study
)
override

Is study in this repository?

init

Future<void> init()

Loads all studies from the PersistenceService.

Called by SmartPhoneClientManager.configure after the persistence service is initialized.

removeStudy

void removeStudy(
  1. SmartphoneStudy study
)
override

Remove study which is already stored in the repository. In case study is not stored in this repository, nothing happens.

toString

String toString()
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.

updateStudy

void updateStudy(
  1. SmartphoneStudy study
)
override

Update a study which is already stored in the repository. In case study is not stored in this repository, nothing happens.