getInformedConsent method

Future<Map<String, InformedConsentInput?>> getInformedConsent()

Get informed consent data for all participants (by role name) in this study deployment with studyDeploymentId. Informed consent which is not set equals null.

Implementation

Future<Map<String, InformedConsentInput?>> getInformedConsent() async {
  Map<String, InformedConsentInput?> map = {};

  ParticipantData data = ParticipantData.fromJson(
      await _rpc(GetParticipantData(studyDeploymentId)));

  for (var roleData in data.roles) {
    if (roleData.data.containsKey(InformedConsentInput.type)) {
      map[roleData.roleName] = roleData.data[InformedConsentInput.type] !=
              null
          ? roleData.data[InformedConsentInput.type] as InformedConsentInput
          : null;
    } else {
      map[roleData.roleName] = null;
    }
  }

  return map;
}